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

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 1 10:17:45 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(
----------------
jansvoboda11 wrote:

Do you need to fully qualify declarations in this file? Could you drop `clang::tooling::dependencies` thanks to the `using namespace` at the top? If not, could you make the declaration names a bit more concise if you wrapped the entire file in `namespace clang::tooling::dependencies { ... }` instead?

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


More information about the cfe-commits mailing list