================
@@ -45,6 +45,23 @@ void AssignmentInIfConditionCheck::check(
return true;
}
+ // Only traverse the result expression of a statement expression,
+ // looking through labels and attributes on the last statement.
+ bool TraverseStmtExpr(StmtExpr *SE,
+ DataRecursionQueue *Queue = nullptr) {
+ Stmt *Last = SE->getSubStmt()->body_back();
+ while (Last && !isa<Expr>(Last))
+ if (auto *LS = dyn_cast<LabelStmt>(Last))
+ Last = LS->getSubStmt();
+ else if (auto *AS = dyn_cast<AttributedStmt>(Last))
+ Last = AS->getSubStmt();
+ else
+ return true;
----------------
unterumarmung wrote:
Could we simplify this loop by using `ValueStmt::getExprStmt()`? It seems to
already handle unwrapping `LabelStmt` and `AttributedStmt`.
https://github.com/llvm/llvm-project/pull/231704
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits