File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -180,11 +180,20 @@ static std::unordered_set<std::string> collectInputFilenames(swift::CompilerInst
180
180
return sourceFiles;
181
181
}
182
182
183
+ static std::vector<swift::ModuleDecl*> collectLoadedModules (swift::CompilerInstance& compiler) {
184
+ std::vector<swift::ModuleDecl*> ret;
185
+ for (const auto & [id, module ] : compiler.getASTContext ().getLoadedModules ()) {
186
+ std::ignore = id;
187
+ ret.push_back (module );
188
+ }
189
+ return ret;
190
+ }
191
+
183
192
void codeql::extractSwiftFiles (const SwiftExtractorConfiguration& config,
184
193
swift::CompilerInstance& compiler) {
185
194
auto inputFiles = collectInputFilenames (compiler);
186
- std::vector<swift::ModuleDecl*> todo = {compiler. getMainModule ()} ;
187
- std::unordered_set<swift::ModuleDecl*> seen = {compiler. getMainModule ()};
195
+ std::vector<swift::ModuleDecl*> todo = collectLoadedModules (compiler) ;
196
+ std::unordered_set<swift::ModuleDecl*> seen{todo. begin (), todo. end ()};
188
197
189
198
while (!todo.empty ()) {
190
199
auto module = todo.back ();
You can’t perform that action at this time.
0 commit comments