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
173
173
void codeql::extractSwiftFiles (SwiftExtractorState& state, swift::CompilerInstance& compiler) {
174
174
auto inputFiles = collectInputFilenames (compiler);
175
175
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 ()) ;
177
177
178
178
while (!todo.empty ()) {
179
179
auto module = todo.back ();
@@ -196,9 +196,9 @@ void codeql::extractSwiftFiles(SwiftExtractorState& state, swift::CompilerInstan
196
196
encounteredModules = extractDeclarations (state, compiler, *module );
197
197
}
198
198
for (auto encountered : encounteredModules) {
199
- if (seen .count (encountered) == 0 ) {
199
+ if (state. encounteredModules .count (encountered) == 0 ) {
200
200
todo.push_back (encountered);
201
- seen .insert (encountered);
201
+ state. encounteredModules .insert (encountered);
202
202
}
203
203
}
204
204
}
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
3
#include < vector>
4
+ #include < unordered_set>
4
5
#include < filesystem>
5
6
6
7
#include < swift/AST/Decl.h>
@@ -14,6 +15,10 @@ struct SwiftExtractorState {
14
15
// All the trap files related to this extraction. This may also include trap files generated in a
15
16
// previous run but that this run requested as well. Paths are relative to `configuration.trapDir`
16
17
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;
17
22
};
18
23
19
24
} // namespace codeql
You can’t perform that action at this time.
0 commit comments