[clang] [clang][DependencyScanning] Track modules that resolve from "shared" locations (PR #130634)

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 17 13:47:32 PDT 2025


================
@@ -157,6 +157,32 @@ static void optimizeCWD(CowCompilerInvocation &BuildInvocation, StringRef CWD) {
   }
 }
 
+/// Check a subset of invocation options to determine whether the current
+/// context can safely be considered as shareable.
+static bool areOptionsInSharedDir(CowCompilerInvocation &BuildInvocation,
+                                  const ArrayRef<StringRef> SharedDirs) {
+  const auto &HSOpts = BuildInvocation.getHeaderSearchOpts();
+  if (!isPathInSharedDir(SharedDirs, HSOpts.Sysroot))
----------------
benlangmuir wrote:

Should the first two checks be asserts since we derive sharable directories from sysroot and resource dir?  Or is there a case where they will differ?

https://github.com/llvm/llvm-project/pull/130634


More information about the cfe-commits mailing list