@@ -5499,79 +5499,6 @@ class BuiltinBitCastExpr final
54995499 }
55005500};
55015501
5502- // / Represents an expansion-init-list of an enumerating expansion statement.
5503- // /
5504- // / For example, in
5505- // / \verbatim
5506- // / template for (auto x : { 1, 2, 3 }) {
5507- // / // ...
5508- // / }
5509- // / \endverbatim
5510- // /
5511- // / the '{ 1, 2, 3 }' part is parsed and stored as a 'CXXExpansionInitListExpr';
5512- // / syntactically, this *looks* very similar to an initializer list, but it
5513- // / isn't actually an expression: '{ 1, 2, 3 }' as a whole is never evaluated
5514- // / or emitted, only the individual expressions '1', '2', and '3' are. We still
5515- // / represent it as an expression in the AST for simplicity.
5516- // /
5517- // / \see CXXEnumeratingExpansionStmtPattern
5518- class CXXExpansionInitListExpr final
5519- : public Expr,
5520- llvm::TrailingObjects<CXXExpansionInitListExpr, Expr *> {
5521- friend class ASTStmtReader ;
5522- friend TrailingObjects;
5523-
5524- const unsigned NumExprs;
5525- SourceLocation LBraceLoc;
5526- SourceLocation RBraceLoc;
5527-
5528- CXXExpansionInitListExpr (EmptyShell ES, unsigned NumExprs);
5529- CXXExpansionInitListExpr (ArrayRef<Expr *> Exprs, SourceLocation LBraceLoc,
5530- SourceLocation RBraceLoc);
5531-
5532- public:
5533- static CXXExpansionInitListExpr *Create (const ASTContext &C,
5534- ArrayRef<Expr *> Exprs,
5535- SourceLocation LBraceLoc,
5536- SourceLocation RBraceLoc);
5537-
5538- static CXXExpansionInitListExpr *
5539- CreateEmpty (const ASTContext &C, EmptyShell Empty, unsigned NumExprs);
5540-
5541- ArrayRef<Expr *> getExprs () const { return getTrailingObjects (NumExprs); }
5542- MutableArrayRef<Expr *> getExprs () { return getTrailingObjects (NumExprs); }
5543- unsigned getNumExprs () const { return NumExprs; }
5544-
5545- bool containsPackExpansion () const ;
5546-
5547- SourceLocation getBeginLoc () const { return getLBraceLoc (); }
5548- SourceLocation getEndLoc () const { return getRBraceLoc (); }
5549-
5550- SourceLocation getLBraceLoc () const { return LBraceLoc; }
5551- SourceLocation getRBraceLoc () const { return RBraceLoc; }
5552-
5553- child_range children () {
5554- const_child_range CCR =
5555- const_cast <const CXXExpansionInitListExpr *>(this )->children ();
5556- return child_range (cast_away_const (CCR.begin ()),
5557- cast_away_const (CCR.end ()));
5558- }
5559-
5560- const_child_range children () const {
5561- Stmt **Stmts = getTrailingStmts ();
5562- return const_child_range (Stmts, Stmts + NumExprs);
5563- }
5564-
5565- static bool classof (const Stmt *T) {
5566- return T->getStmtClass () == CXXExpansionInitListExprClass;
5567- }
5568-
5569- private:
5570- Stmt **getTrailingStmts () const {
5571- return reinterpret_cast <Stmt **>(const_cast <Expr **>(getTrailingObjects ()));
5572- }
5573- };
5574-
55755502// / Helper that selects an expression from an expansion init list depending
55765503// / on the current expansion index.
55775504// /
@@ -5585,17 +5512,17 @@ class CXXExpansionInitListSelectExpr : public Expr {
55855512public:
55865513 CXXExpansionInitListSelectExpr (EmptyShell Empty);
55875514 CXXExpansionInitListSelectExpr (const ASTContext &C,
5588- CXXExpansionInitListExpr *Range, Expr *Idx);
5515+ InitListExpr *Range, Expr *Idx);
55895516
5590- CXXExpansionInitListExpr *getRangeExpr () {
5591- return cast<CXXExpansionInitListExpr >(SubExprs[RANGE]);
5517+ InitListExpr *getRangeExpr () {
5518+ return cast<InitListExpr >(SubExprs[RANGE]);
55925519 }
55935520
5594- const CXXExpansionInitListExpr *getRangeExpr () const {
5595- return cast<CXXExpansionInitListExpr >(SubExprs[RANGE]);
5521+ const InitListExpr *getRangeExpr () const {
5522+ return cast<InitListExpr >(SubExprs[RANGE]);
55965523 }
55975524
5598- void setRangeExpr (CXXExpansionInitListExpr *E) { SubExprs[RANGE] = E; }
5525+ void setRangeExpr (InitListExpr *E) { SubExprs[RANGE] = E; }
55995526
56005527 Expr *getIndexExpr () { return SubExprs[INDEX]; }
56015528 const Expr *getIndexExpr () const { return SubExprs[INDEX]; }
0 commit comments