mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Resolve cross-import overlays relative to defining interface for prebuilt binary Swift dependencies
When the dependency scanner picks a pre-built binary module candidate for a given dependency, it needs to be able to attempt to resolve its cross-import overlays relative to the textual interface that the binary module was built from. For example, if a collection of binary modules are located in, and resolved as dependencies from, a pre-built module directory, the scanner must lookup their corresponding cross-import overlays relative to the defining interface as read out from the binary module's MODULE_INTERFACE_PATH. https://github.com/swiftlang/swift/pull/70817 ensures that binary modules serialize the path to their defining textual interface. Resolves rdar://130778577
This commit is contained in:
@@ -92,19 +92,6 @@ static bool isTargetTooNew(const llvm::Triple &moduleTarget,
|
||||
return ctxTarget.isOSVersionLT(moduleTarget);
|
||||
}
|
||||
|
||||
std::string ModuleFile::resolveModuleDefiningFilename(const ASTContext &ctx) {
|
||||
if (!Core->ModuleInterfacePath.empty()) {
|
||||
std::string interfacePath = Core->ModuleInterfacePath.str();
|
||||
if (llvm::sys::path::is_relative(interfacePath)) {
|
||||
SmallString<128> absoluteInterfacePath(ctx.SearchPathOpts.getSDKPath());
|
||||
llvm::sys::path::append(absoluteInterfacePath, interfacePath);
|
||||
return absoluteInterfacePath.str().str();
|
||||
} else
|
||||
return interfacePath;
|
||||
} else
|
||||
return getModuleLoadedFilename().str();
|
||||
}
|
||||
|
||||
namespace swift {
|
||||
namespace serialization {
|
||||
bool areCompatible(const llvm::Triple &moduleTarget,
|
||||
@@ -272,7 +259,8 @@ Status ModuleFile::associateWithFileContext(FileUnit *file, SourceLoc diagLoc,
|
||||
|
||||
ASTContext &ctx = getContext();
|
||||
// Resolve potentially-SDK-relative module-defining .swiftinterface path
|
||||
ResolvedModuleDefiningFilename = resolveModuleDefiningFilename(ctx);
|
||||
ResolvedModuleDefiningFilename =
|
||||
Core->resolveModuleDefiningFilePath(ctx.SearchPathOpts.getSDKPath());
|
||||
|
||||
llvm::Triple moduleTarget(llvm::Triple::normalize(Core->TargetTriple));
|
||||
if (!areCompatible(moduleTarget, ctx.LangOpts.Target)) {
|
||||
|
||||
Reference in New Issue
Block a user