mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Always serialize module-defining '.swiftinterface', even if SDK-relative.
The clients, upon loading, will resolve the SDK-relative path to their SDK location. Resolves rdar://120673684
This commit is contained in:
@@ -91,6 +91,19 @@ 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,
|
||||
@@ -257,6 +270,8 @@ Status ModuleFile::associateWithFileContext(FileUnit *file, SourceLoc diagLoc,
|
||||
}
|
||||
|
||||
ASTContext &ctx = getContext();
|
||||
// Resolve potentially-SDK-relative module-defining .swiftinterface path
|
||||
ResolvedModuleDefiningFilename = resolveModuleDefiningFilename(ctx);
|
||||
|
||||
llvm::Triple moduleTarget(llvm::Triple::normalize(Core->TargetTriple));
|
||||
if (!areCompatible(moduleTarget, ctx.LangOpts.Target)) {
|
||||
|
||||
Reference in New Issue
Block a user