@@ -2023,7 +2023,7 @@ class PredefinedExpr final
20232023 void setFunctionName (StringLiteral *SL) {
20242024 assert (hasFunctionName () &&
20252025 " This PredefinedExpr has no storage for a function name!" );
2026- *getTrailingObjects<Stmt *> () = SL;
2026+ *getTrailingObjects () = SL;
20272027 }
20282028
20292029public:
@@ -2050,13 +2050,13 @@ class PredefinedExpr final
20502050
20512051 StringLiteral *getFunctionName () {
20522052 return hasFunctionName ()
2053- ? static_cast <StringLiteral *>(*getTrailingObjects<Stmt *> ())
2053+ ? static_cast <StringLiteral *>(*getTrailingObjects ())
20542054 : nullptr ;
20552055 }
20562056
20572057 const StringLiteral *getFunctionName () const {
20582058 return hasFunctionName ()
2059- ? static_cast <StringLiteral *>(*getTrailingObjects<Stmt *> ())
2059+ ? static_cast <StringLiteral *>(*getTrailingObjects ())
20602060 : nullptr ;
20612061 }
20622062
@@ -2078,13 +2078,11 @@ class PredefinedExpr final
20782078
20792079 // Iterators
20802080 child_range children () {
2081- return child_range (getTrailingObjects<Stmt *>(),
2082- getTrailingObjects<Stmt *>() + hasFunctionName ());
2081+ return child_range (getTrailingObjects (hasFunctionName ()));
20832082 }
20842083
20852084 const_child_range children () const {
2086- return const_child_range (getTrailingObjects<Stmt *>(),
2087- getTrailingObjects<Stmt *>() + hasFunctionName ());
2085+ return const_child_range (getTrailingObjects (hasFunctionName ()));
20882086 }
20892087};
20902088
@@ -2248,18 +2246,14 @@ class UnaryOperator final
22482246 private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride> {
22492247 Stmt *Val;
22502248
2251- size_t numTrailingObjects (OverloadToken<FPOptionsOverride>) const {
2252- return UnaryOperatorBits.HasFPFeatures ? 1 : 0 ;
2253- }
2254-
22552249 FPOptionsOverride &getTrailingFPFeatures () {
22562250 assert (UnaryOperatorBits.HasFPFeatures );
2257- return *getTrailingObjects<FPOptionsOverride> ();
2251+ return *getTrailingObjects ();
22582252 }
22592253
22602254 const FPOptionsOverride &getTrailingFPFeatures () const {
22612255 assert (UnaryOperatorBits.HasFPFeatures );
2262- return *getTrailingObjects<FPOptionsOverride> ();
2256+ return *getTrailingObjects ();
22632257 }
22642258
22652259public:
@@ -2580,32 +2574,27 @@ class OffsetOfExpr final
25802574 }
25812575
25822576 const OffsetOfNode &getComponent (unsigned Idx) const {
2583- assert (Idx < NumComps && " Subscript out of range" );
2584- return getTrailingObjects<OffsetOfNode>()[Idx];
2577+ return getTrailingObjects<OffsetOfNode>(NumComps)[Idx];
25852578 }
25862579
25872580 void setComponent (unsigned Idx, OffsetOfNode ON) {
2588- assert (Idx < NumComps && " Subscript out of range" );
2589- getTrailingObjects<OffsetOfNode>()[Idx] = ON;
2581+ getTrailingObjects<OffsetOfNode>(NumComps)[Idx] = ON;
25902582 }
25912583
25922584 unsigned getNumComponents () const {
25932585 return NumComps;
25942586 }
25952587
25962588 Expr* getIndexExpr (unsigned Idx) {
2597- assert (Idx < NumExprs && " Subscript out of range" );
2598- return getTrailingObjects<Expr *>()[Idx];
2589+ return getTrailingObjects<Expr *>(NumExprs)[Idx];
25992590 }
26002591
26012592 const Expr *getIndexExpr (unsigned Idx) const {
2602- assert (Idx < NumExprs && " Subscript out of range" );
2603- return getTrailingObjects<Expr *>()[Idx];
2593+ return getTrailingObjects<Expr *>(NumExprs)[Idx];
26042594 }
26052595
26062596 void setIndexExpr (unsigned Idx, Expr* E) {
2607- assert (Idx < NumComps && " Subscript out of range" );
2608- getTrailingObjects<Expr *>()[Idx] = E;
2597+ getTrailingObjects<Expr *>(NumComps)[Idx] = E;
26092598 }
26102599
26112600 unsigned getNumExpressions () const {
@@ -4619,12 +4608,12 @@ class ConvertVectorExpr final
46194608
46204609 FPOptionsOverride &getTrailingFPFeatures () {
46214610 assert (ConvertVectorExprBits.HasFPFeatures );
4622- return *getTrailingObjects<FPOptionsOverride> ();
4611+ return *getTrailingObjects ();
46234612 }
46244613
46254614 const FPOptionsOverride &getTrailingFPFeatures () const {
46264615 assert (ConvertVectorExprBits.HasFPFeatures );
4627- return *getTrailingObjects<FPOptionsOverride> ();
4616+ return *getTrailingObjects ();
46284617 }
46294618
46304619public:
@@ -5705,13 +5694,11 @@ class DesignatedInitExpr final
57055694 unsigned getNumSubExprs () const { return NumSubExprs; }
57065695
57075696 Expr *getSubExpr (unsigned Idx) const {
5708- assert (Idx < NumSubExprs && " Subscript out of range" );
5709- return cast<Expr>(getTrailingObjects<Stmt *>()[Idx]);
5697+ return cast<Expr>(getTrailingObjects (NumSubExprs)[Idx]);
57105698 }
57115699
57125700 void setSubExpr (unsigned Idx, Expr *E) {
5713- assert (Idx < NumSubExprs && " Subscript out of range" );
5714- getTrailingObjects<Stmt *>()[Idx] = E;
5701+ getTrailingObjects (NumSubExprs)[Idx] = E;
57155702 }
57165703
57175704 // / Replaces the designator at index @p Idx with the series
@@ -5730,11 +5717,11 @@ class DesignatedInitExpr final
57305717
57315718 // Iterators
57325719 child_range children () {
5733- Stmt **begin = getTrailingObjects<Stmt *> ();
5720+ Stmt **begin = getTrailingObjects ();
57345721 return child_range (begin, begin + NumSubExprs);
57355722 }
57365723 const_child_range children () const {
5737- Stmt * const *begin = getTrailingObjects<Stmt *> ();
5724+ Stmt *const *begin = getTrailingObjects ();
57385725 return const_child_range (begin, begin + NumSubExprs);
57395726 }
57405727
@@ -5994,9 +5981,7 @@ class ParenListExpr final
59945981 return const_cast <ParenListExpr *>(this )->getExpr (Init);
59955982 }
59965983
5997- Expr **getExprs () {
5998- return reinterpret_cast <Expr **>(getTrailingObjects<Stmt *>());
5999- }
5984+ Expr **getExprs () { return reinterpret_cast <Expr **>(getTrailingObjects ()); }
60005985
60015986 ArrayRef<Expr *> exprs () { return llvm::ArrayRef (getExprs (), getNumExprs ()); }
60025987
@@ -6011,12 +5996,10 @@ class ParenListExpr final
60115996
60125997 // Iterators
60135998 child_range children () {
6014- return child_range (getTrailingObjects<Stmt *>(),
6015- getTrailingObjects<Stmt *>() + getNumExprs ());
5999+ return child_range (getTrailingObjects (getNumExprs ()));
60166000 }
60176001 const_child_range children () const {
6018- return const_child_range (getTrailingObjects<Stmt *>(),
6019- getTrailingObjects<Stmt *>() + getNumExprs ());
6002+ return const_child_range (getTrailingObjects (getNumExprs ()));
60206003 }
60216004};
60226005
@@ -6421,14 +6404,12 @@ class GenericSelectionExpr final
64216404 }
64226405
64236406 child_range children () {
6424- return child_range (getTrailingObjects<Stmt *>(),
6425- getTrailingObjects<Stmt *>() +
6426- numTrailingObjects (OverloadToken<Stmt *>()));
6407+ return child_range (getTrailingObjects<Stmt *>(
6408+ numTrailingObjects (OverloadToken<Stmt *>())));
64276409 }
64286410 const_child_range children () const {
6429- return const_child_range (getTrailingObjects<Stmt *>(),
6430- getTrailingObjects<Stmt *>() +
6431- numTrailingObjects (OverloadToken<Stmt *>()));
6411+ return const_child_range (getTrailingObjects<Stmt *>(
6412+ numTrailingObjects (OverloadToken<Stmt *>())));
64326413 }
64336414};
64346415
@@ -6647,11 +6628,6 @@ class PseudoObjectExpr final
66476628 // in to Create, which is an index within the semantic forms.
66486629 // Note also that ASTStmtWriter assumes this encoding.
66496630
6650- Expr **getSubExprsBuffer () { return getTrailingObjects<Expr *>(); }
6651- const Expr * const *getSubExprsBuffer () const {
6652- return getTrailingObjects<Expr *>();
6653- }
6654-
66556631 PseudoObjectExpr (QualType type, ExprValueKind VK,
66566632 Expr *syntactic, ArrayRef<Expr*> semantic,
66576633 unsigned resultIndex);
@@ -6677,8 +6653,8 @@ class PseudoObjectExpr final
66776653 // / Return the syntactic form of this expression, i.e. the
66786654 // / expression it actually looks like. Likely to be expressed in
66796655 // / terms of OpaqueValueExprs bound in the semantic form.
6680- Expr *getSyntacticForm () { return getSubExprsBuffer ()[0 ]; }
6681- const Expr *getSyntacticForm () const { return getSubExprsBuffer ()[0 ]; }
6656+ Expr *getSyntacticForm () { return getTrailingObjects ()[0 ]; }
6657+ const Expr *getSyntacticForm () const { return getTrailingObjects ()[0 ]; }
66826658
66836659 // / Return the index of the result-bearing expression into the semantics
66846660 // / expressions, or PseudoObjectExpr::NoResult if there is none.
@@ -6691,7 +6667,7 @@ class PseudoObjectExpr final
66916667 Expr *getResultExpr () {
66926668 if (PseudoObjectExprBits.ResultIndex == 0 )
66936669 return nullptr ;
6694- return getSubExprsBuffer ()[PseudoObjectExprBits.ResultIndex ];
6670+ return getTrailingObjects ()[PseudoObjectExprBits.ResultIndex ];
66956671 }
66966672 const Expr *getResultExpr () const {
66976673 return const_cast <PseudoObjectExpr*>(this )->getResultExpr ();
@@ -6701,29 +6677,26 @@ class PseudoObjectExpr final
67016677
67026678 typedef Expr * const *semantics_iterator;
67036679 typedef const Expr * const *const_semantics_iterator;
6704- semantics_iterator semantics_begin () {
6705- return getSubExprsBuffer () + 1 ;
6706- }
6680+ semantics_iterator semantics_begin () { return getTrailingObjects () + 1 ; }
67076681 const_semantics_iterator semantics_begin () const {
6708- return getSubExprsBuffer () + 1 ;
6682+ return getTrailingObjects () + 1 ;
67096683 }
67106684 semantics_iterator semantics_end () {
6711- return getSubExprsBuffer () + getNumSubExprs ();
6685+ return getTrailingObjects () + getNumSubExprs ();
67126686 }
67136687 const_semantics_iterator semantics_end () const {
6714- return getSubExprsBuffer () + getNumSubExprs ();
6688+ return getTrailingObjects () + getNumSubExprs ();
67156689 }
67166690
67176691 ArrayRef<Expr*> semantics () {
6718- return ArrayRef ( semantics_begin (), semantics_end () );
6692+ return getTrailingObjects ( getNumSubExprs ()). drop_front ( );
67196693 }
67206694 ArrayRef<const Expr*> semantics () const {
6721- return ArrayRef ( semantics_begin (), semantics_end () );
6695+ return getTrailingObjects ( getNumSubExprs ()). drop_front ( );
67226696 }
67236697
67246698 Expr *getSemanticExpr (unsigned index) {
6725- assert (index + 1 < getNumSubExprs ());
6726- return getSubExprsBuffer ()[index + 1 ];
6699+ return getTrailingObjects (getNumSubExprs ())[index + 1 ];
67276700 }
67286701 const Expr *getSemanticExpr (unsigned index) const {
67296702 return const_cast <PseudoObjectExpr*>(this )->getSemanticExpr (index);
@@ -6748,7 +6721,7 @@ class PseudoObjectExpr final
67486721 }
67496722 const_child_range children () const {
67506723 Stmt *const *cs = const_cast <Stmt *const *>(
6751- reinterpret_cast <const Stmt *const *>(getSubExprsBuffer ()));
6724+ reinterpret_cast <const Stmt *const *>(getTrailingObjects ()));
67526725 return const_child_range (cs, cs + getNumSubExprs ());
67536726 }
67546727
0 commit comments