File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ static std::vector<swift::ModuleDecl*> collectLoadedModules(swift::CompilerInsta
173173void codeql::extractSwiftFiles (SwiftExtractorState& state, swift::CompilerInstance& compiler) {
174174 auto inputFiles = collectInputFilenames (compiler);
175175 std::vector<swift::ModuleDecl*> todo = collectLoadedModules (compiler);
176- std::unordered_set<swift::ModuleDecl*> seen{ todo.begin (), todo.end ()} ;
176+ state. encounteredModules . insert ( todo.begin (), todo.end ()) ;
177177
178178 while (!todo.empty ()) {
179179 auto module = todo.back ();
@@ -196,9 +196,9 @@ void codeql::extractSwiftFiles(SwiftExtractorState& state, swift::CompilerInstan
196196 encounteredModules = extractDeclarations (state, compiler, *module );
197197 }
198198 for (auto encountered : encounteredModules) {
199- if (seen .count (encountered) == 0 ) {
199+ if (state. encounteredModules .count (encountered) == 0 ) {
200200 todo.push_back (encountered);
201- seen .insert (encountered);
201+ state. encounteredModules .insert (encountered);
202202 }
203203 }
204204 }
Original file line number Diff line number Diff line change 11#pragma once
22
33#include < vector>
4+ #include < unordered_set>
45#include < filesystem>
56
67#include < swift/AST/Decl.h>
@@ -14,6 +15,10 @@ struct SwiftExtractorState {
1415 // All the trap files related to this extraction. This may also include trap files generated in a
1516 // previous run but that this run requested as well. Paths are relative to `configuration.trapDir`
1617 std::vector<std::filesystem::path> traps;
18+
19+ // All modules encountered during this extractor run, which therefore are dependencies of the
20+ // outcomes of this run
21+ std::unordered_set<const swift::ModuleDecl*> encounteredModules;
1722};
1823
1924} // namespace codeql
You can’t perform that action at this time.
0 commit comments