Skip to content

Commit 44a8f99

Browse files
committed
[DependencyScanning] Count target variant, clang target, and sdk versions as components of scanning context hash
Resolves rdar://103093122
1 parent 0286461 commit 44a8f99

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,16 @@ namespace swift {
631631
/// Return a hash code of any components from these options that should
632632
/// contribute to a Swift Dependency Scanning hash.
633633
llvm::hash_code getModuleScanningHashComponents() const {
634-
return getPCHHashComponents();
634+
auto hashValue = getPCHHashComponents();
635+
if (TargetVariant.hasValue())
636+
hashValue = llvm::hash_combine(hashValue, TargetVariant.getValue().str());
637+
if (ClangTarget.hasValue())
638+
hashValue = llvm::hash_combine(hashValue, ClangTarget.getValue().str());
639+
if (SDKVersion.hasValue())
640+
hashValue = llvm::hash_combine(hashValue, SDKVersion.getValue().getAsString());
641+
if (VariantSDKVersion.hasValue())
642+
hashValue = llvm::hash_combine(hashValue, VariantSDKVersion.getValue().getAsString());
643+
return hashValue;
635644
}
636645

637646
private:

lib/AST/ModuleDependencies.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,10 @@ ModuleDependenciesCache::getDependencyReferencesMap(
439439
ModuleDependenciesCache::ModuleDependenciesCache(
440440
GlobalModuleDependenciesCache &globalCache,
441441
std::string mainScanModuleName,
442-
std::string scanningContextHash)
442+
std::string scannerContextHash)
443443
: globalCache(globalCache),
444444
mainScanModuleName(mainScanModuleName),
445+
scannerContextHash(scannerContextHash),
445446
clangScanningTool(globalCache.ClangScanningService) {
446447
globalCache.configureForContextHash(scannerContextHash);
447448
for (auto kind = ModuleDependenciesKind::FirstKind;

0 commit comments

Comments
 (0)