@@ -1222,13 +1222,12 @@ class CaseStmt final
12221222
12231223 llvm::PointerIntPair<BraceStmt *, 1 , bool > BodyAndHasFallthrough;
12241224
1225- std::optional< ArrayRef<VarDecl *> > CaseBodyVariables;
1225+ ArrayRef<VarDecl *> CaseBodyVariables;
12261226
12271227 CaseStmt (CaseParentKind ParentKind, SourceLoc ItemIntroducerLoc,
12281228 ArrayRef<CaseLabelItem> CaseLabelItems, SourceLoc UnknownAttrLoc,
12291229 SourceLoc ItemTerminatorLoc, BraceStmt *Body,
1230- std::optional<ArrayRef<VarDecl *>> CaseBodyVariables,
1231- std::optional<bool > Implicit,
1230+ ArrayRef<VarDecl *> CaseBodyVariables, std::optional<bool > Implicit,
12321231 NullablePtr<FallthroughStmt> fallthroughStmt);
12331232
12341233public:
@@ -1248,7 +1247,7 @@ class CaseStmt final
12481247 create (ASTContext &C, CaseParentKind ParentKind, SourceLoc ItemIntroducerLoc,
12491248 ArrayRef<CaseLabelItem> CaseLabelItems, SourceLoc UnknownAttrLoc,
12501249 SourceLoc ItemTerminatorLoc, BraceStmt *Body,
1251- std::optional< ArrayRef<VarDecl *> > CaseBodyVariables,
1250+ ArrayRef<VarDecl *> CaseBodyVariables,
12521251 std::optional<bool > Implicit = std::nullopt ,
12531252 NullablePtr<FallthroughStmt> fallthroughStmt = nullptr );
12541253
@@ -1293,7 +1292,7 @@ class CaseStmt final
12931292 void setBody (BraceStmt *body) { BodyAndHasFallthrough.setPointer (body); }
12941293
12951294 // / 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 (); }
12971296
12981297 // / Get the source location of the 'case', 'default', or 'catch' of the first
12991298 // / label.
@@ -1345,20 +1344,8 @@ class CaseStmt final
13451344 }
13461345
13471346 // / 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.
13521347 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;
13621349 }
13631350
13641351 // / Find the next case statement within the same 'switch' or 'do-catch',
0 commit comments