Skip to content

Commit 604328e

Browse files
committed
Swift: strip suffix from swiftmodule trap files
1 parent 652230d commit 604328e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

swift/extractor/SwiftExtractor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ static std::string getFilename(swift::ModuleDecl& module, swift::SourceFile* pri
5656
}
5757
// PCM clang module
5858
if (module.isNonSwiftModule()) {
59-
// Several modules with different name might come from .pcm (clang module) files
59+
// Several modules with different names might come from .pcm (clang module) files
6060
// In this case we want to differentiate them
61+
// Moreover, pcm files may come from caches located in different directories, but are
62+
// unambiguously identified by the base file name, so we can discard the absolute directory
6163
std::string filename = "/pcms/"s + llvm::sys::path::filename(module.getModuleFilename()).str();
6264
filename += "-";
6365
filename += module.getName().str();
@@ -175,9 +177,8 @@ void codeql::extractSwiftFiles(const SwiftExtractorConfiguration& config,
175177
// extracted from source with more information. We do this by creating empty trap files.
176178
// TargetFile semantics will ensure any following run trying to extract that swiftmodule will just
177179
// skip doing it
178-
auto outputModuleTrapSuffix = "-" + compiler.getMainModule()->getName().str().str() + ".trap";
179180
for (const auto& output : config.outputSwiftModules) {
180-
TargetFile::create(output + outputModuleTrapSuffix, config.trapDir, config.getTempTrapDir());
181+
TargetFile::create(output, config.trapDir, config.getTempTrapDir());
181182
}
182183
for (auto& module : modules) {
183184
bool isFromSourceFile = false;

0 commit comments

Comments
 (0)