[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 09:58:47 PDT 2025
================
@@ -434,14 +535,39 @@ bool DependencyScanningAction::runInvocation(
ScanInstance.createSourceManager(*FileMgr);
+ // Consider different header search and diagnostic options to create
+ // different modules. This avoids the unsound aliasing of module PCMs.
+ //
+ // TODO: Implement diagnostic bucketing to reduce the impact of strict
+ // context hashing.
+ ScanInstance.getHeaderSearchOpts().ModulesStrictContextHash = true;
+ ScanInstance.getHeaderSearchOpts().ModulesSerializeOnlyPreprocessor = true;
+ ScanInstance.getHeaderSearchOpts().ModulesSkipDiagnosticOptions = true;
+ ScanInstance.getHeaderSearchOpts().ModulesSkipHeaderSearchPaths = true;
+ ScanInstance.getHeaderSearchOpts().ModulesSkipPragmaDiagnosticMappings = true;
+ ScanInstance.getHeaderSearchOpts().ModulesForceValidateUserHeaders = false;
+
+ // Avoid some checks and module map parsing when loading PCM files.
+ ScanInstance.getPreprocessorOpts().ModulesCheckRelocated = false;
+
+ return true;
+}
+
+llvm::SmallVector<StringRef> clang::tooling::dependencies::computeStableDirs(
----------------
jansvoboda11 wrote:
Yes, I'm referring to `computePrebuiltModulesASTMap()` which you need to call after `computeStableDirs()` to actually compute the stable directories. This leads me to believe that the current name is misleading. Let's either call this `getInitialStableDirs()` to imply there are more steps required to get the final stable directory set, or let's fold this into `computePrebuiltModulesASTMap()` and figure out a better name.
https://github.com/llvm/llvm-project/pull/161300
More information about the cfe-commits
mailing list