[clang] 12e3ed8 - [clang] Avoid possibly expensive SM call when suppression-mappings are off

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 06:58:09 PST 2024


Author: Kadir Cetinkaya
Date: 2024-11-12T15:57:38+01:00
New Revision: 12e3ed8de8c6063b15916b3faf67c8c9cd17df1f

URL: https://github.com/llvm/llvm-project/commit/12e3ed8de8c6063b15916b3faf67c8c9cd17df1f
DIFF: https://github.com/llvm/llvm-project/commit/12e3ed8de8c6063b15916b3faf67c8c9cd17df1f.diff

LOG: [clang] Avoid possibly expensive SM call when suppression-mappings are off

Added: 
    

Modified: 
    clang/lib/Basic/DiagnosticIDs.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp
index ccce70d18ebf54..44922aa7872dbf 100644
--- a/clang/lib/Basic/DiagnosticIDs.cpp
+++ b/clang/lib/Basic/DiagnosticIDs.cpp
@@ -601,7 +601,7 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc,
     return diag::Severity::Ignored;
 
   // Clang-diagnostics pragmas always take precedence over suppression mapping.
-  if (!Mapping.isPragma()) {
+  if (!Mapping.isPragma() && Diag.DiagSuppressionMapping) {
     // We also use presumed locations here to improve reproducibility for
     // preprocessed inputs.
     if (PresumedLoc PLoc = SM.getPresumedLoc(Loc);


        


More information about the cfe-commits mailing list