Skip to content

Commit 353536b

Browse files
committed
Swift: collect original output module paths
1 parent 84b285a commit 353536b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

swift/extractor/config/SwiftExtractorState.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ struct SwiftExtractorState {
2121
std::unordered_set<const swift::ModuleDecl*> encounteredModules;
2222

2323
std::vector<std::filesystem::path> sourceFiles;
24+
25+
// The path for the modules outputted by the underlying frontend run, ignoring path redirection
26+
std::vector<std::filesystem::path> originalOutputModules;
2427
};
2528

2629
} // namespace codeql

swift/extractor/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ static void lockOutputSwiftModuleTraps(codeql::SwiftExtractorState& state,
3535
}
3636
}
3737

38-
static void processFrontendOptions(swift::FrontendOptions& options) {
38+
static void processFrontendOptions(codeql::SwiftExtractorState& state,
39+
swift::FrontendOptions& options) {
3940
auto& inOuts = options.InputsAndOutputs;
4041
std::vector<swift::InputFile> inputs;
4142
inOuts.forEachInput([&](const swift::InputFile& input) {
@@ -53,6 +54,7 @@ static void processFrontendOptions(swift::FrontendOptions& options) {
5354
input.getPrimarySpecificPaths().SupplementaryOutputs.ModuleOutputPath;
5455
!module.empty()) {
5556
psp.SupplementaryOutputs.ModuleOutputPath = codeql::redirect(module);
57+
state.originalOutputModules.push_back(module);
5658
}
5759
auto inputCopy = input;
5860
inputCopy.setPrimarySpecificPaths(std::move(psp));
@@ -77,7 +79,7 @@ class Observer : public swift::FrontendObserver {
7779
void parsedArgs(swift::CompilerInvocation& invocation) override {
7880
auto& options = invocation.getFrontendOptions();
7981
lockOutputSwiftModuleTraps(state, options);
80-
processFrontendOptions(options);
82+
processFrontendOptions(state, options);
8183
}
8284

8385
void configuredCompiler(swift::CompilerInstance& instance) override {

0 commit comments

Comments
 (0)