[llvm-branch-commits] [clang] Speed up diagnostic state file lookup (PR #241234)

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 19 02:12:02 PST 2026


================
@@ -7372,6 +7372,14 @@ void ASTReader::ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag) {
       return NewState;
     };
 
+    auto GetDiagStateFile =
+        [&](FileID FID) -> DiagnosticsEngine::DiagStateMap::File & {
+      auto &File = Diag.DiagStatesByLoc.Files[FID];
+      if (!File)
+        File = std::make_unique<DiagnosticsEngine::DiagStateMap::File>();
+      return *File;
+    };
----------------
zmodem wrote:

Maybe this should be a method on DiagStateMap instead? Perhaps the code can be shared with what's at the top of DiagStateMap::getFileUncached?

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


More information about the llvm-branch-commits mailing list