ModuleInterface: pass-down paths obfuscator to module interface building commands

While implicitly building .swiftinterface, the interface may import other binary modules.
These binary modules may contain serialized search paths that have been obfuscated. To help
interface building commands recover these search paths, we need to pass down the obfuscators
to the module building commands.

rdar://87840268
This commit is contained in:
Xi Ge
2022-01-20 14:40:10 -08:00
parent 2daff9fef3
commit 53d46841d4
4 changed files with 53 additions and 1 deletions

View File

@@ -1341,6 +1341,15 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
genericSubInvocation.getLangOptions().DisableAvailabilityChecking = true;
GenericArgs.push_back("-disable-availability-checking");
}
// Pass-down the obfuscators so we can get the serialized search paths properly.
genericSubInvocation.setSerializedPathObfuscator(
SearchPathOpts.DeserializedPathRecoverer);
SearchPathOpts.DeserializedPathRecoverer
.forEachPair([&](StringRef lhs, StringRef rhs) {
GenericArgs.push_back(ArgSaver.save(llvm::Twine("-serialized-path-obfuscate ")
+ lhs + "=" + rhs).str());
});
}
bool InterfaceSubContextDelegateImpl::extractSwiftInterfaceVersionAndArgs(