@@ -136,6 +136,7 @@ makeTransitiveImportsVisible(ASTContext &Ctx, VisibleModuleSet &VisibleModules,
136
136
" modules only." );
137
137
138
138
llvm::SmallVector<Module *, 4 > Worklist;
139
+ llvm::SmallSet<Module *, 16 > Visited;
139
140
Worklist.push_back (Imported);
140
141
141
142
Module *FoundPrimaryModuleInterface =
@@ -144,18 +145,22 @@ makeTransitiveImportsVisible(ASTContext &Ctx, VisibleModuleSet &VisibleModules,
144
145
while (!Worklist.empty ()) {
145
146
Module *Importing = Worklist.pop_back_val ();
146
147
147
- if (VisibleModules. isVisible (Importing))
148
+ if (Visited. count (Importing))
148
149
continue ;
150
+ Visited.insert (Importing);
149
151
150
152
// FIXME: The ImportLoc here is not meaningful. It may be problematic if we
151
153
// use the sourcelocation loaded from the visible modules.
152
154
VisibleModules.setVisible (Importing, ImportLoc);
153
155
154
156
if (isImportingModuleUnitFromSameModule (Ctx, Importing, CurrentModule,
155
- FoundPrimaryModuleInterface))
157
+ FoundPrimaryModuleInterface)) {
156
158
for (Module *TransImported : Importing->Imports )
157
- if (!VisibleModules.isVisible (TransImported))
158
- Worklist.push_back (TransImported);
159
+ Worklist.push_back (TransImported);
160
+
161
+ for (auto [Exports, _] : Importing->Exports )
162
+ Worklist.push_back (Exports);
163
+ }
159
164
}
160
165
}
161
166
0 commit comments