[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 2 07:13:06 PDT 2025


================
@@ -3056,26 +3045,51 @@ class IndirectGotoStmt : public Stmt {
   }
 };
 
-/// ContinueStmt - This represents a continue.
-class ContinueStmt : public Stmt {
-public:
-  ContinueStmt(SourceLocation CL) : Stmt(ContinueStmtClass) {
-    setContinueLoc(CL);
+/// Base class for BreakStmt and ContinueStmt.
+class LoopControlStmt : public Stmt {
+  /// If this is a labeled break/continue, the label whose statement we're
+  /// targeting.
+  LabelDecl *TargetLabel = nullptr;
+
+  /// Location of the label, if any.
+  SourceLocation Label;
----------------
Sirraide wrote:

> Why is this necessary? Shouldn't we be able to do `TargetLabel->getBeginLoc` or something?

I think it defintely was necessary w/ the old approach, but it might not be anymore; I’ll take another look at this.

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


More information about the cfe-commits mailing list