https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/182217

This caused a performance regression as reported in 
https://github.com/llvm/llvm-project/pull/141950

>From 4289713021e3d2538c91ad37a81de5ad0c2e2292 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Wed, 18 Feb 2026 07:11:07 +0100
Subject: [PATCH] [clang] Avoid calling isInSystemMacro() too often

This caused a performance regression as reported in
https://github.com/llvm/llvm-project/pull/141950
---
 clang/lib/Basic/DiagnosticIDs.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Basic/DiagnosticIDs.cpp 
b/clang/lib/Basic/DiagnosticIDs.cpp
index 804f0d9957f23..fcd2d9f34414e 100644
--- a/clang/lib/Basic/DiagnosticIDs.cpp
+++ b/clang/lib/Basic/DiagnosticIDs.cpp
@@ -570,13 +570,13 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, 
SourceLocation Loc,
   // We also ignore warnings due to system macros. As above, we respect the
   // ForceSystemWarnings override.
   if (State->SuppressSystemWarnings && !Diag.getForceSystemWarnings() &&
-      Loc.isValid() && SM.isInSystemMacro(Loc)) {
+      Loc.isValid()) {
 
     bool ShowInSystemMacro = true;
     if (const StaticDiagInfoRec *Rec = GetDiagInfo(DiagID))
       ShowInSystemMacro = Rec->WarnShowInSystemMacro;
 
-    if (!ShowInSystemMacro)
+    if (!ShowInSystemMacro && SM.isInSystemMacro(Loc))
       return diag::Severity::Ignored;
   }
   // Clang-diagnostics pragmas always take precedence over suppression mapping.

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to