[clang] Traverse attributes in `AttributedStmt`. (PR #117692)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 03:06:09 PST 2024


https://github.com/16bit-ykiko updated https://github.com/llvm/llvm-project/pull/117692

>From e7779c27eaf28f454090a4a42517ad0eac978680 Mon Sep 17 00:00:00 2001
From: ykiko <ykikoykikoykiko at gmail.com>
Date: Tue, 26 Nov 2024 17:51:00 +0800
Subject: [PATCH] Add stmts.

---
 clang/include/clang/AST/RecursiveASTVisitor.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index b2dd51319ba9ea..6ab9d0e71d71aa 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -2442,7 +2442,10 @@ DEF_TRAVERSE_STMT(GotoStmt, {})
 DEF_TRAVERSE_STMT(IfStmt, {})
 DEF_TRAVERSE_STMT(IndirectGotoStmt, {})
 DEF_TRAVERSE_STMT(LabelStmt, {})
-DEF_TRAVERSE_STMT(AttributedStmt, {})
+DEF_TRAVERSE_STMT(AttributedStmt, {
+  for (auto *I : S->getAttrs())
+    TRY_TO(getDerived().TraverseAttr(const_cast<clang::Attr *>(I)));
+})
 DEF_TRAVERSE_STMT(NullStmt, {})
 DEF_TRAVERSE_STMT(ObjCAtCatchStmt, {})
 DEF_TRAVERSE_STMT(ObjCAtFinallyStmt, {})



More information about the cfe-commits mailing list