[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 18 10:46:14 PDT 2024


================
@@ -1293,6 +1293,10 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
                                             diag::remark_module_build_done)
     << ModuleName;
 
+  // Propagate the statistics to the parent FileManager.
+  if (FrontendOpts.ModulesShareFileManager)
----------------
jansvoboda11 wrote:

Shouldn't this condition be inverted? When `FrontendOpts.ModulesShareFileManager == true`, I'd expect `&ImportingInstance.getFileManager() == &Instance.getFileManager()`. Maybe we can have an assertion in `FileManager::AddStats()` that would catch this.

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


More information about the cfe-commits mailing list