[llvm-branch-commits] [clang] [release/22.x][clang] Avoid calling isInSystemMacro() too often (#182… (PR #182726)
Timm Baeder via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Feb 21 21:50:16 PST 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/182726
…217)
This caused a performance regression as reported in https://github.com/llvm/llvm-project/pull/141950
>From 8a5b01fbf333806336ba201596f3884c5d8e25db Mon Sep 17 00:00:00 2001
From: Timm Baeder <tbaeder at redhat.com>
Date: Sun, 22 Feb 2026 06:21:33 +0100
Subject: [PATCH] [release/22.x][clang] Avoid calling isInSystemMacro() too
often (#182217)
This caused a performance regression as reported in
https://github.com/llvm/llvm-project/pull/141950
---
clang/lib/Basic/DiagnosticIDs.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp
index a1d9d0f34d20d..45aa901da307c 100644
--- a/clang/lib/Basic/DiagnosticIDs.cpp
+++ b/clang/lib/Basic/DiagnosticIDs.cpp
@@ -562,14 +562,13 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc,
return diag::Severity::Ignored;
}
// We also ignore warnings due to system macros
- if (State->SuppressSystemWarnings && Loc.isValid() &&
- SM.isInSystemMacro(Loc)) {
+ if (State->SuppressSystemWarnings && 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.
More information about the llvm-branch-commits
mailing list