[clang] [clang] Add break/continue stmts with missing lable to the AST (PR #168332)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 17 05:50:11 PST 2025


================
@@ -2313,10 +2313,8 @@ StmtResult Parser::ParseBreakOrContinueStatement(bool IsContinue) {
       // TODO: Make this a compatibility/extension warning instead once the
       // syntax of this feature is finalised.
       Diag(LabelLoc, diag::err_c2y_labeled_break_continue) << IsContinue;
-    if (!Target) {
+    if (!Target)
       Diag(LabelLoc, diag::err_break_continue_label_not_found) << IsContinue;
-      return StmtError();
----------------
Sirraide wrote:

I feel like the main issue here is the fact that we’re trying to constant-evaluate a function that contains an error... which is a bit questionable imo.

> we could break to the nearest loop as a way to recover, but that may end up generating confusing false positives with CFG-based diagnostics

I don’t believe CFG-based diagnostics run if there was an error (at least the ones in the static analyser don’t)?


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


More information about the cfe-commits mailing list