================
@@ -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();
----------------
AaronBallman wrote:

I'm not certain this is correct; we're emitting an error. I think that branch 
should return `StmtError()` rather than a valid `ContinueStmt` or `BreakStmt`. 
The prior branch not returning is a bit more reasonable when we have a valid 
target because the semantics the AST models will still be what the programmer 
intended. The same is not true for the case where we couldn't find the target; 
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, so I think a 
`RecoveryExpr` makes more sense. WDYT?

https://github.com/llvm/llvm-project/pull/168332
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to