Skip to content

Commit 81431cb

Browse files
committed
Dependency scanning: setting default clang optimization to all instead of default.
1 parent 8ad295a commit 81431cb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/AST/ModuleDependencies.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,13 @@ SwiftDependencyScanningService::SwiftDependencyScanningService() {
490490
clang::CASOptions(),
491491
/* CAS (llvm::cas::ObjectStore) */ nullptr,
492492
/* Cache (llvm::cas::ActionCache) */ nullptr,
493-
/* SharedFS */ nullptr);
493+
/* SharedFS */ nullptr,
494+
// ScanningOptimizations::Default excludes the current working
495+
// directory optimization. Clang needs to communicate with
496+
// the build system to handle the optimization safely.
497+
// Swift can handle the working directory optimizaiton
498+
// already so it is safe to turn on all optimizations.
499+
clang::tooling::dependencies::ScanningOptimizations::All);
494500
SharedFilesystemCache.emplace();
495501
}
496502

@@ -748,7 +754,11 @@ bool SwiftDependencyScanningService::setupCachingDependencyScanningService(
748754
ClangScanningFormat,
749755
Instance.getInvocation().getCASOptions().CASOpts,
750756
Instance.getSharedCASInstance(), Instance.getSharedCacheInstance(),
751-
UseClangIncludeTree ? nullptr : CacheFS);
757+
UseClangIncludeTree ? nullptr : CacheFS,
758+
// The current working directory optimization (off by default)
759+
// should not impact CAS. We set the optization to all to be
760+
// consistent with the non-CAS case.
761+
clang::tooling::dependencies::ScanningOptimizations::All);
752762

753763
return false;
754764
}

0 commit comments

Comments
 (0)