Skip to content

Commit b7dc4c7

Browse files
don't scan every available module for cross-import overlays
rdar://74928853
1 parent 66e712b commit b7dc4c7

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tools/driver/swift_symbolgraph_extract_main.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,16 @@ int swift_symbolgraph_extract_main(ArrayRef<const char *> Args, const char *Argv
260260
// don't need to print these errors.
261261
CI.removeDiagnosticConsumer(&DiagPrinter);
262262

263-
for (const auto &ModuleName : VisibleModuleNames) {
264-
if (ModuleName.str().startswith("_")) {
265-
auto CIM = CI.getASTContext().getModuleByName(ModuleName.str());
266-
if (CIM && CIM->isCrossImportOverlayOf(M)) {
267-
const auto &CIMainFile = CIM->getMainFile(FileUnitKind::SerializedAST);
268-
llvm::errs() << "Emitting symbol graph for cross-import overlay module file: "
269-
<< CIMainFile.getModuleDefiningPath() << '\n';
270-
271-
Success |= symbolgraphgen::emitSymbolGraphForModule(CIM, Options);
272-
}
263+
SmallVector<ModuleDecl *, 2> Overlays;
264+
M->findDeclaredCrossImportOverlaysTransitive(Overlays);
265+
for (const auto *OM : Overlays) {
266+
auto CIM = CI.getASTContext().getModuleByName(OM->getNameStr());
267+
if (CIM) {
268+
const auto &CIMainFile = CIM->getMainFile(FileUnitKind::SerializedAST);
269+
llvm::errs() << "Emitting symbol graph for cross-import overlay module file: "
270+
<< CIMainFile.getModuleDefiningPath() << '\n';
271+
272+
Success |= symbolgraphgen::emitSymbolGraphForModule(CIM, Options);
273273
}
274274
}
275275

0 commit comments

Comments
 (0)