[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)
Yutong Zhu via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 07:14:56 PST 2025
================
@@ -658,7 +649,13 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
Next = SC->getSubStmt();
else if (LabelStmt *LS = dyn_cast<LabelStmt>(SubStmt))
Next = LS->getSubStmt();
- else
+ else if (AttributedStmt *AS = dyn_cast<AttributedStmt>(SubStmt)) {
+ if (GetMustTailAttr(AS)) {
+ LabelAndGotoScopes[AS] = ParentScope;
+ MustTailStmts.push_back(AS);
+ }
+ Next = AS->getSubStmt();
+ } else
----------------
YutongZhuu wrote:
Please correct me if my understanding is incorrect.
This function is basically doing a DFS on the AST and skipping the nodes that is not considered to be scope parents(also could you confirm attributes can not be scope parents?). If my understanding is correct, the node for attributes will be skipped and ``case Stmt::AttributedStmtClass`` never gets executed.
https://github.com/llvm/llvm-project/pull/125370
More information about the cfe-commits
mailing list