https://github.com/zeyi2 created 
https://github.com/llvm/llvm-project/pull/223197

None

>From 780786fe673db6d11e9446fa4041b1208bc52fec Mon Sep 17 00:00:00 2001
From: Zeyi Xu <[email protected]>
Date: Sun, 13 Sep 2026 10:14:51 +0800
Subject: [PATCH] [clang-tidy] Speed up bugprone-multiple-statement-macro

---
 .../clang-tidy/bugprone/MultipleStatementMacroCheck.cpp      | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
index bf026f9374437..4baeb97ce1290 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
@@ -57,10 +57,11 @@ getExpansionRanges(SourceLocation Loc, const 
MatchFinder::MatchResult &Result) {
 void MultipleStatementMacroCheck::registerMatchers(MatchFinder *Finder) {
   const auto Inner = expr(isInMacro(), unless(compoundStmt())).bind("inner");
   Finder->addMatcher(
-      stmt(anyOf(ifStmt(hasThen(Inner)), ifStmt(hasElse(Inner)).bind("else"),
-                 whileStmt(hasBody(Inner)), forStmt(hasBody(Inner))))
+      ifStmt(anyOf(hasThen(Inner), allOf(hasElse(Inner), stmt().bind("else"))))
           .bind("outer"),
       this);
+  Finder->addMatcher(whileStmt(hasBody(Inner)).bind("outer"), this);
+  Finder->addMatcher(forStmt(hasBody(Inner)).bind("outer"), this);
 }
 
 void MultipleStatementMacroCheck::check(

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

Reply via email to