-
Notifications
You must be signed in to change notification settings - Fork 12.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Traverse attributes in AttributedStmt
.
#117692
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-clang Author: ykiko (16bit-ykiko) ChangesFix #117687. Full diff: https://github.com/llvm/llvm-project/pull/117692.diff 1 Files Affected:
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, {})
|
A test failed after the modification, but it really confused me // Contexts where there is no function call, no diagnostic.
bool bad();
template <bool>
requires requires { bad(); }
void g() [[clang::nonblocking]] {}
void g() [[clang::nonblocking]] {
decltype(bad()) a; // doesn't generate a call so, OK
[[maybe_unused]] auto b = noexcept(bad());
[[maybe_unused]] auto c = sizeof(bad());
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wassume"
[[assume(bad())]]; // never evaluated, but maybe still semantically questionable?
#pragma clang diagnostic pop
}
I don't know what happened here. They seem to have no connection at all. |
What seems to be happening here is that we’re now traversing the argument of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! Please be sure to also add some test coverage for the changes to clang/unittests/AST/RecursiveASTVisitorTest.cpp
.
Fix #117687.