mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Modules] Avoid false swift module sharing
When the swiftmodule is built with different clang importer arguments, they can have the same module hash, causing them to be wrongly re-used even they contains different interfaces. Add ReducedExtraArgs to the module hash to disambiguate them. However, some Xcc arguments, most commonly `-D` options do not affect the swiftmodule being generated. Do not pass `-Xcc -DARGS` to swift interface compilation to reduce the amount of module variants in the build. rdar://131408266
This commit is contained in:
@@ -2072,6 +2072,8 @@ InterfaceSubContextDelegateImpl::getCacheHash(StringRef useInterfacePath,
|
||||
auto normalizedTargetTriple =
|
||||
getTargetSpecificModuleTriple(genericSubInvocation.getLangOptions().Target);
|
||||
std::string sdkBuildVersion = getSDKBuildVersion(sdkPath);
|
||||
const auto ExtraArgs = genericSubInvocation.getClangImporterOptions()
|
||||
.getReducedExtraArgsForSwiftModuleDependency();
|
||||
|
||||
llvm::hash_code H = hash_combine(
|
||||
// Start with the compiler version (which will be either tag names or
|
||||
@@ -2113,6 +2115,10 @@ InterfaceSubContextDelegateImpl::getCacheHash(StringRef useInterfacePath,
|
||||
// correctly load the dependencies.
|
||||
genericSubInvocation.getCASOptions().getModuleScanningHashComponents(),
|
||||
|
||||
// Clang ExtraArgs that affects how clang types are imported into swift
|
||||
// module.
|
||||
llvm::hash_combine_range(ExtraArgs.begin(), ExtraArgs.end()),
|
||||
|
||||
// Whether or not OSSA modules are enabled.
|
||||
//
|
||||
// If OSSA modules are enabled, we use a separate namespace of modules to
|
||||
|
||||
Reference in New Issue
Block a user