[clang] [clang][Dependency Scanning] Refactor Scanning Compiler Instance Initialization (PR #161300)

Qiongsi Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 2 08:46:16 PDT 2025


================
@@ -355,44 +355,149 @@ void clang::tooling::dependencies::sanitizeDiagOpts(
         .Default(true);
   });
 }
+} // namespace
 
-bool DependencyScanningAction::runInvocation(
-    std::shared_ptr<CompilerInvocation> Invocation,
-    IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
-    std::shared_ptr<PCHContainerOperations> PCHContainerOps,
-    DiagnosticConsumer *DiagConsumer) {
-  // Making sure that we canonicalize the defines before we create the deep
-  // copy to avoid unnecessary variants in the scanner and in the resulting
-  // explicit command lines.
-  if (any(Service.getOptimizeArgs() & ScanningOptimizations::Macros))
-    canonicalizeDefines(Invocation->getPreprocessorOpts());
+std::unique_ptr<DiagnosticOptions>
+clang::tooling::dependencies::createDiagOptions(
----------------
qiongsiwu wrote:

> If not, could you make the declaration names a bit more concise if you wrapped the entire file in namespace clang::tooling::dependencies { ... } instead?

Yup done! Thanks for the suggestion! 

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


More information about the cfe-commits mailing list