@@ -1159,36 +1159,29 @@ class alignas(1 << PatternAlignInBits) CaseLabelItem {
1159
1159
// / FallthroughStmt - The keyword "fallthrough".
1160
1160
class FallthroughStmt : public Stmt {
1161
1161
SourceLoc Loc;
1162
- CaseStmt *FallthroughSource;
1163
- CaseStmt *FallthroughDest;
1162
+ DeclContext *DC;
1164
1163
1165
- public:
1166
- FallthroughStmt (SourceLoc Loc, std::optional<bool > implicit = std::nullopt )
1164
+ FallthroughStmt (SourceLoc Loc, DeclContext *DC,
1165
+ std::optional<bool > implicit = std::nullopt )
1167
1166
: Stmt(StmtKind::Fallthrough, getDefaultImplicitFlag(implicit, Loc)),
1168
- Loc (Loc), FallthroughSource(nullptr ), FallthroughDest(nullptr ) {}
1167
+ Loc (Loc), DC(DC) {}
1168
+ public:
1169
+ static FallthroughStmt *createParsed (SourceLoc Loc, DeclContext *DC);
1169
1170
1170
1171
SourceLoc getLoc () const { return Loc; }
1171
1172
1172
1173
SourceRange getSourceRange () const { return Loc; }
1173
1174
1175
+ DeclContext *getDeclContext () const { return DC; }
1176
+ void setDeclContext (DeclContext *newDC) { DC = newDC; }
1177
+
1174
1178
// / Get the CaseStmt block from which the fallthrough transfers control.
1175
- // / Set during Sema. (May stay null if fallthrough is invalid.)
1176
- CaseStmt *getFallthroughSource () const { return FallthroughSource; }
1177
- void setFallthroughSource (CaseStmt *C) {
1178
- assert (!FallthroughSource && " fallthrough source already set?!" );
1179
- FallthroughSource = C;
1180
- }
1179
+ // / Returns \c nullptr if the fallthrough is invalid.
1180
+ CaseStmt *getFallthroughSource () const ;
1181
1181
1182
1182
// / Get the CaseStmt block to which the fallthrough transfers control.
1183
- // / Set during Sema.
1184
- CaseStmt *getFallthroughDest () const {
1185
- assert (FallthroughDest && " fallthrough dest is not set until Sema" );
1186
- return FallthroughDest;
1187
- }
1188
- void setFallthroughDest (CaseStmt *C) {
1189
- assert (!FallthroughDest && " fallthrough dest already set?!" );
1190
- FallthroughDest = C;
1191
- }
1183
+ // / Returns \c nullptr if the fallthrough is invalid.
1184
+ CaseStmt *getFallthroughDest () const ;
1192
1185
1193
1186
static bool classof (const Stmt *S) {
1194
1187
return S->getKind () == StmtKind::Fallthrough;
@@ -1613,6 +1606,7 @@ class BreakStmt : public Stmt {
1613
1606
}
1614
1607
1615
1608
DeclContext *getDeclContext () const { return DC; }
1609
+ void setDeclContext (DeclContext *newDC) { DC = newDC; }
1616
1610
1617
1611
static bool classof (const Stmt *S) {
1618
1612
return S->getKind () == StmtKind::Break;
@@ -1648,6 +1642,7 @@ class ContinueStmt : public Stmt {
1648
1642
}
1649
1643
1650
1644
DeclContext *getDeclContext () const { return DC; }
1645
+ void setDeclContext (DeclContext *newDC) { DC = newDC; }
1651
1646
1652
1647
static bool classof (const Stmt *S) {
1653
1648
return S->getKind () == StmtKind::Continue;
0 commit comments