Skip to content

Commit 2121d32

Browse files
committed
[Dependency Scanning] Skip over source-code (not interface) modules when collecting cross import overlays
1 parent 41f65d7 commit 2121d32

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/AST/ModuleLoader.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,18 @@ ModuleDependencies::collectCrossImportOverlayNames(ASTContext &ctx,
180180
llvm::StringMap<llvm::SmallSetVector<Identifier, 4>> result;
181181
// Mimic getModuleDefiningPath() for Swift and Clang module.
182182
if (auto *swiftDep = getAsSwiftTextualModule()) {
183-
// Prefer interface path to binary module path if we have it.
184-
modulePath = swiftDep->swiftInterfaceFile;
185-
assert(modulePath.hasValue());
186-
StringRef parentDir = llvm::sys::path::parent_path(*modulePath);
187-
if (llvm::sys::path::extension(parentDir) == ".swiftmodule") {
188-
modulePath = parentDir.str();
183+
if (swiftDep->swiftInterfaceFile.hasValue()) {
184+
// Prefer interface path to binary module path if we have it.
185+
modulePath = swiftDep->swiftInterfaceFile;
186+
assert(modulePath.hasValue());
187+
StringRef parentDir = llvm::sys::path::parent_path(*modulePath);
188+
if (llvm::sys::path::extension(parentDir) == ".swiftmodule") {
189+
modulePath = parentDir.str();
190+
}
191+
} else {
192+
// This must be a module compiled from source-code
193+
assert(!swiftDep->sourceFiles.empty());
194+
return result;
189195
}
190196
} else if (auto *swiftBinaryDep = getAsSwiftBinaryModule()) {
191197
modulePath = swiftBinaryDep->compiledModulePath;

0 commit comments

Comments
 (0)