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
180180 return sourceFiles;
181181}
182182
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+
183192void codeql::extractSwiftFiles (const SwiftExtractorConfiguration& config,
184193 swift::CompilerInstance& compiler) {
185194 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 ()};
188197
189198 while (!todo.empty ()) {
190199 auto module = todo.back ();
You can’t perform that action at this time.
0 commit comments