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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: ykiko (16bit-ykiko)

<details>
<summary>Changes</summary>

Fix https://github.com/llvm/llvm-project/issues/117687.

---
Full diff: https://github.com/llvm/llvm-project/pull/117692.diff


1 Files Affected:

- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+4-1) 


``````````diff
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, {})

``````````

</details>


https://github.com/llvm/llvm-project/pull/117692


More information about the cfe-commits mailing list