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

Boaz Brickner via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 07:44:49 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();
----------------
bricknerb wrote:

"SM" is common.
"auto" not that common.
"SourceMgr" is also relatively common, much more readable and fits better to the style guide.

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


More information about the cfe-commits mailing list