[clang] [clang][DependencyScanning] Implementation of `CompilerInstanceWithContext` to Improve By-Name Queries (PR #164345)

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 24 15:20:27 PDT 2025


================
@@ -150,6 +151,54 @@ std::shared_ptr<ModuleDepCollector> initializeScanInstanceDependencyCollector(
     DependencyActionController &Controller,
     PrebuiltModulesAttrsMap PrebuiltModulesASTMap,
     llvm::SmallVector<StringRef> &StableDirs);
+
+class CompilerInstanceWithContext {
+  // Context
+  DependencyScanningWorker &Worker;
+  llvm::StringRef CWD;
+  std::vector<std::string> CommandLine;
+  static const uint64_t MAX_NUM_NAMES = (1 << 12);
+  static const std::string FakeFileBuffer;
----------------
benlangmuir wrote:

> Jan caught it that we are not using the fake file buffer.

I guess I'll see what you intended when you fix this, but I'm confused about how this can safely be `static`.  For thread safety I would assume it should be non-static so that it's tied to the worker.

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


More information about the cfe-commits mailing list