@@ -490,7 +490,13 @@ SwiftDependencyScanningService::SwiftDependencyScanningService() {
490
490
clang::CASOptions (),
491
491
/* CAS (llvm::cas::ObjectStore) */ nullptr ,
492
492
/* 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);
494
500
SharedFilesystemCache.emplace ();
495
501
}
496
502
@@ -748,7 +754,11 @@ bool SwiftDependencyScanningService::setupCachingDependencyScanningService(
748
754
ClangScanningFormat,
749
755
Instance.getInvocation ().getCASOptions ().CASOpts ,
750
756
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);
752
762
753
763
return false ;
754
764
}
0 commit comments