@@ -1222,13 +1222,12 @@ class CaseStmt final
1222
1222
1223
1223
llvm::PointerIntPair<BraceStmt *, 1 , bool > BodyAndHasFallthrough;
1224
1224
1225
- std::optional< ArrayRef<VarDecl *> > CaseBodyVariables;
1225
+ ArrayRef<VarDecl *> CaseBodyVariables;
1226
1226
1227
1227
CaseStmt (CaseParentKind ParentKind, SourceLoc ItemIntroducerLoc,
1228
1228
ArrayRef<CaseLabelItem> CaseLabelItems, SourceLoc UnknownAttrLoc,
1229
1229
SourceLoc ItemTerminatorLoc, BraceStmt *Body,
1230
- std::optional<ArrayRef<VarDecl *>> CaseBodyVariables,
1231
- std::optional<bool > Implicit,
1230
+ ArrayRef<VarDecl *> CaseBodyVariables, std::optional<bool > Implicit,
1232
1231
NullablePtr<FallthroughStmt> fallthroughStmt);
1233
1232
1234
1233
public:
@@ -1248,7 +1247,7 @@ class CaseStmt final
1248
1247
create (ASTContext &C, CaseParentKind ParentKind, SourceLoc ItemIntroducerLoc,
1249
1248
ArrayRef<CaseLabelItem> CaseLabelItems, SourceLoc UnknownAttrLoc,
1250
1249
SourceLoc ItemTerminatorLoc, BraceStmt *Body,
1251
- std::optional< ArrayRef<VarDecl *> > CaseBodyVariables,
1250
+ ArrayRef<VarDecl *> CaseBodyVariables,
1252
1251
std::optional<bool > Implicit = std::nullopt ,
1253
1252
NullablePtr<FallthroughStmt> fallthroughStmt = nullptr );
1254
1253
@@ -1293,7 +1292,7 @@ class CaseStmt final
1293
1292
void setBody (BraceStmt *body) { BodyAndHasFallthrough.setPointer (body); }
1294
1293
1295
1294
// / True if the case block declares any patterns with local variable bindings.
1296
- bool hasBoundDecls () const { return CaseBodyVariables.has_value (); }
1295
+ bool hasCaseBodyVariables () const { return ! CaseBodyVariables.empty (); }
1297
1296
1298
1297
// / Get the source location of the 'case', 'default', or 'catch' of the first
1299
1298
// / label.
@@ -1345,20 +1344,8 @@ class CaseStmt final
1345
1344
}
1346
1345
1347
1346
// / Return an ArrayRef containing the case body variables of this CaseStmt.
1348
- // /
1349
- // / Asserts if case body variables was not explicitly initialized. In contexts
1350
- // / where one wants a non-asserting version, \see
1351
- // / getCaseBodyVariablesOrEmptyArray.
1352
1347
ArrayRef<VarDecl *> getCaseBodyVariables () const {
1353
- return *CaseBodyVariables;
1354
- }
1355
-
1356
- bool hasCaseBodyVariables () const { return CaseBodyVariables.has_value (); }
1357
-
1358
- ArrayRef<VarDecl *> getCaseBodyVariablesOrEmptyArray () const {
1359
- if (!CaseBodyVariables)
1360
- return ArrayRef<VarDecl *>();
1361
- return *CaseBodyVariables;
1348
+ return CaseBodyVariables;
1362
1349
}
1363
1350
1364
1351
// / Find the next case statement within the same 'switch' or 'do-catch',
0 commit comments