================
@@ -470,6 +470,23 @@ StmtResult Sema::ActOnCompoundStmt(SourceLocation L,
SourceLocation R,
DiagnoseEmptyLoopBody(Elts[i], Elts[i + 1]);
}
+ // Find defer statements that immediately precede a break/continue statement.
+ std::optional<SourceLocation> DeferLoc = std::nullopt;
+ for (unsigned i = 0; i != NumElts; ++i) {
----------------
Sirraide wrote:
I feel like it’d be easier to just check if `i` is a defer statement and `i +
1` a break/continue statement (we could also check for `return` statements that
don’t have a subexpression). In that case we also need to skip the check if
`NumElts == 0`.
https://github.com/llvm/llvm-project/pull/225748
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits