[clang] [clang-tools-extra] [llvm] [clang] Introduce diagnostics suppression mappings (PR #112517)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 06:56:15 PDT 2024


================
@@ -575,25 +575,42 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc,
       DiagID != diag::fatal_too_many_errors && Diag.FatalsAsError)
     Result = diag::Severity::Error;
 
+  // Rest of the mappings are only applicable for diagnostics associated with a
+  // SourceLocation, bail out early for others.
+  if (!Diag.hasSourceManager())
+    return Result;
+
+  const auto &SM = Diag.getSourceManager();
----------------
kadircet wrote:

hmm not sure where that's coming from, but in my experience it's actually much more common to name this as `SM` and use `auto`. so i'd rather keep it as-is (happy to provide some pointers offline if need be).

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


More information about the cfe-commits mailing list