================
@@ -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;
+
+protected:
+ LoopControlStmt(StmtClass Class, SourceLocation Loc) : Stmt(Class) {
+ setKwLoc(Loc);
}
- /// Build an empty continue statement.
- explicit ContinueStmt(EmptyShell Empty) : Stmt(ContinueStmtClass, Empty) {}
+ LoopControlStmt(StmtClass Class, SourceLocation Loc, SourceLocation LabelLoc,
+ LabelDecl *Target)
+ : LoopControlStmt(Class, Loc) {
+ setLabelLoc(LabelLoc);
----------------
Sirraide wrote:
> These should use designated initializers instead if at all possible. Is there
> a reason they cannot?
I don’t think there is a reason other than `BreakStmt`/`ContinueStmt` didn’t
have them before and it didn’t occur to me to refactor this.
https://github.com/llvm/llvm-project/pull/152870
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits