Skip to content

[DependencyScanning] Count target variant, clang target, and sdk versions as components of scanning context hash #62471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,16 @@ namespace swift {
/// Return a hash code of any components from these options that should
/// contribute to a Swift Dependency Scanning hash.
llvm::hash_code getModuleScanningHashComponents() const {
return getPCHHashComponents();
auto hashValue = getPCHHashComponents();
if (TargetVariant.hasValue())
hashValue = llvm::hash_combine(hashValue, TargetVariant.getValue().str());
if (ClangTarget.hasValue())
hashValue = llvm::hash_combine(hashValue, ClangTarget.getValue().str());
if (SDKVersion.hasValue())
hashValue = llvm::hash_combine(hashValue, SDKVersion.getValue().getAsString());
if (VariantSDKVersion.hasValue())
hashValue = llvm::hash_combine(hashValue, VariantSDKVersion.getValue().getAsString());
return hashValue;
}

private:
Expand Down
3 changes: 2 additions & 1 deletion lib/AST/ModuleDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,10 @@ ModuleDependenciesCache::getDependencyReferencesMap(
ModuleDependenciesCache::ModuleDependenciesCache(
GlobalModuleDependenciesCache &globalCache,
std::string mainScanModuleName,
std::string scanningContextHash)
std::string scannerContextHash)
: globalCache(globalCache),
mainScanModuleName(mainScanModuleName),
scannerContextHash(scannerContextHash),
clangScanningTool(globalCache.ClangScanningService) {
globalCache.configureForContextHash(scannerContextHash);
for (auto kind = ModuleDependenciesKind::FirstKind;
Expand Down