@@ -2023,7 +2023,7 @@ class PredefinedExpr final
2023
2023
void setFunctionName (StringLiteral *SL) {
2024
2024
assert (hasFunctionName () &&
2025
2025
" This PredefinedExpr has no storage for a function name!" );
2026
- *getTrailingObjects<Stmt *> () = SL;
2026
+ *getTrailingObjects () = SL;
2027
2027
}
2028
2028
2029
2029
public:
@@ -2050,13 +2050,13 @@ class PredefinedExpr final
2050
2050
2051
2051
StringLiteral *getFunctionName () {
2052
2052
return hasFunctionName ()
2053
- ? static_cast <StringLiteral *>(*getTrailingObjects<Stmt *> ())
2053
+ ? static_cast <StringLiteral *>(*getTrailingObjects ())
2054
2054
: nullptr ;
2055
2055
}
2056
2056
2057
2057
const StringLiteral *getFunctionName () const {
2058
2058
return hasFunctionName ()
2059
- ? static_cast <StringLiteral *>(*getTrailingObjects<Stmt *> ())
2059
+ ? static_cast <StringLiteral *>(*getTrailingObjects ())
2060
2060
: nullptr ;
2061
2061
}
2062
2062
@@ -2078,13 +2078,11 @@ class PredefinedExpr final
2078
2078
2079
2079
// Iterators
2080
2080
child_range children () {
2081
- return child_range (getTrailingObjects<Stmt *>(),
2082
- getTrailingObjects<Stmt *>() + hasFunctionName ());
2081
+ return child_range (getTrailingObjects (hasFunctionName ()));
2083
2082
}
2084
2083
2085
2084
const_child_range children () const {
2086
- return const_child_range (getTrailingObjects<Stmt *>(),
2087
- getTrailingObjects<Stmt *>() + hasFunctionName ());
2085
+ return const_child_range (getTrailingObjects (hasFunctionName ()));
2088
2086
}
2089
2087
};
2090
2088
@@ -2248,18 +2246,14 @@ class UnaryOperator final
2248
2246
private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride> {
2249
2247
Stmt *Val;
2250
2248
2251
- size_t numTrailingObjects (OverloadToken<FPOptionsOverride>) const {
2252
- return UnaryOperatorBits.HasFPFeatures ? 1 : 0 ;
2253
- }
2254
-
2255
2249
FPOptionsOverride &getTrailingFPFeatures () {
2256
2250
assert (UnaryOperatorBits.HasFPFeatures );
2257
- return *getTrailingObjects<FPOptionsOverride> ();
2251
+ return *getTrailingObjects ();
2258
2252
}
2259
2253
2260
2254
const FPOptionsOverride &getTrailingFPFeatures () const {
2261
2255
assert (UnaryOperatorBits.HasFPFeatures );
2262
- return *getTrailingObjects<FPOptionsOverride> ();
2256
+ return *getTrailingObjects ();
2263
2257
}
2264
2258
2265
2259
public:
@@ -2580,32 +2574,27 @@ class OffsetOfExpr final
2580
2574
}
2581
2575
2582
2576
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];
2585
2578
}
2586
2579
2587
2580
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;
2590
2582
}
2591
2583
2592
2584
unsigned getNumComponents () const {
2593
2585
return NumComps;
2594
2586
}
2595
2587
2596
2588
Expr* getIndexExpr (unsigned Idx) {
2597
- assert (Idx < NumExprs && " Subscript out of range" );
2598
- return getTrailingObjects<Expr *>()[Idx];
2589
+ return getTrailingObjects<Expr *>(NumExprs)[Idx];
2599
2590
}
2600
2591
2601
2592
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];
2604
2594
}
2605
2595
2606
2596
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;
2609
2598
}
2610
2599
2611
2600
unsigned getNumExpressions () const {
@@ -4619,12 +4608,12 @@ class ConvertVectorExpr final
4619
4608
4620
4609
FPOptionsOverride &getTrailingFPFeatures () {
4621
4610
assert (ConvertVectorExprBits.HasFPFeatures );
4622
- return *getTrailingObjects<FPOptionsOverride> ();
4611
+ return *getTrailingObjects ();
4623
4612
}
4624
4613
4625
4614
const FPOptionsOverride &getTrailingFPFeatures () const {
4626
4615
assert (ConvertVectorExprBits.HasFPFeatures );
4627
- return *getTrailingObjects<FPOptionsOverride> ();
4616
+ return *getTrailingObjects ();
4628
4617
}
4629
4618
4630
4619
public:
@@ -5705,13 +5694,11 @@ class DesignatedInitExpr final
5705
5694
unsigned getNumSubExprs () const { return NumSubExprs; }
5706
5695
5707
5696
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]);
5710
5698
}
5711
5699
5712
5700
void setSubExpr (unsigned Idx, Expr *E) {
5713
- assert (Idx < NumSubExprs && " Subscript out of range" );
5714
- getTrailingObjects<Stmt *>()[Idx] = E;
5701
+ getTrailingObjects (NumSubExprs)[Idx] = E;
5715
5702
}
5716
5703
5717
5704
// / Replaces the designator at index @p Idx with the series
@@ -5730,11 +5717,11 @@ class DesignatedInitExpr final
5730
5717
5731
5718
// Iterators
5732
5719
child_range children () {
5733
- Stmt **begin = getTrailingObjects<Stmt *> ();
5720
+ Stmt **begin = getTrailingObjects ();
5734
5721
return child_range (begin, begin + NumSubExprs);
5735
5722
}
5736
5723
const_child_range children () const {
5737
- Stmt * const *begin = getTrailingObjects<Stmt *> ();
5724
+ Stmt *const *begin = getTrailingObjects ();
5738
5725
return const_child_range (begin, begin + NumSubExprs);
5739
5726
}
5740
5727
@@ -5994,9 +5981,7 @@ class ParenListExpr final
5994
5981
return const_cast <ParenListExpr *>(this )->getExpr (Init);
5995
5982
}
5996
5983
5997
- Expr **getExprs () {
5998
- return reinterpret_cast <Expr **>(getTrailingObjects<Stmt *>());
5999
- }
5984
+ Expr **getExprs () { return reinterpret_cast <Expr **>(getTrailingObjects ()); }
6000
5985
6001
5986
ArrayRef<Expr *> exprs () { return llvm::ArrayRef (getExprs (), getNumExprs ()); }
6002
5987
@@ -6011,12 +5996,10 @@ class ParenListExpr final
6011
5996
6012
5997
// Iterators
6013
5998
child_range children () {
6014
- return child_range (getTrailingObjects<Stmt *>(),
6015
- getTrailingObjects<Stmt *>() + getNumExprs ());
5999
+ return child_range (getTrailingObjects (getNumExprs ()));
6016
6000
}
6017
6001
const_child_range children () const {
6018
- return const_child_range (getTrailingObjects<Stmt *>(),
6019
- getTrailingObjects<Stmt *>() + getNumExprs ());
6002
+ return const_child_range (getTrailingObjects (getNumExprs ()));
6020
6003
}
6021
6004
};
6022
6005
@@ -6421,14 +6404,12 @@ class GenericSelectionExpr final
6421
6404
}
6422
6405
6423
6406
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 *>())));
6427
6409
}
6428
6410
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 *>())));
6432
6413
}
6433
6414
};
6434
6415
@@ -6647,11 +6628,6 @@ class PseudoObjectExpr final
6647
6628
// in to Create, which is an index within the semantic forms.
6648
6629
// Note also that ASTStmtWriter assumes this encoding.
6649
6630
6650
- Expr **getSubExprsBuffer () { return getTrailingObjects<Expr *>(); }
6651
- const Expr * const *getSubExprsBuffer () const {
6652
- return getTrailingObjects<Expr *>();
6653
- }
6654
-
6655
6631
PseudoObjectExpr (QualType type, ExprValueKind VK,
6656
6632
Expr *syntactic, ArrayRef<Expr*> semantic,
6657
6633
unsigned resultIndex);
@@ -6677,8 +6653,8 @@ class PseudoObjectExpr final
6677
6653
// / Return the syntactic form of this expression, i.e. the
6678
6654
// / expression it actually looks like. Likely to be expressed in
6679
6655
// / 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 ]; }
6682
6658
6683
6659
// / Return the index of the result-bearing expression into the semantics
6684
6660
// / expressions, or PseudoObjectExpr::NoResult if there is none.
@@ -6691,7 +6667,7 @@ class PseudoObjectExpr final
6691
6667
Expr *getResultExpr () {
6692
6668
if (PseudoObjectExprBits.ResultIndex == 0 )
6693
6669
return nullptr ;
6694
- return getSubExprsBuffer ()[PseudoObjectExprBits.ResultIndex ];
6670
+ return getTrailingObjects ()[PseudoObjectExprBits.ResultIndex ];
6695
6671
}
6696
6672
const Expr *getResultExpr () const {
6697
6673
return const_cast <PseudoObjectExpr*>(this )->getResultExpr ();
@@ -6701,29 +6677,26 @@ class PseudoObjectExpr final
6701
6677
6702
6678
typedef Expr * const *semantics_iterator;
6703
6679
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 ; }
6707
6681
const_semantics_iterator semantics_begin () const {
6708
- return getSubExprsBuffer () + 1 ;
6682
+ return getTrailingObjects () + 1 ;
6709
6683
}
6710
6684
semantics_iterator semantics_end () {
6711
- return getSubExprsBuffer () + getNumSubExprs ();
6685
+ return getTrailingObjects () + getNumSubExprs ();
6712
6686
}
6713
6687
const_semantics_iterator semantics_end () const {
6714
- return getSubExprsBuffer () + getNumSubExprs ();
6688
+ return getTrailingObjects () + getNumSubExprs ();
6715
6689
}
6716
6690
6717
6691
ArrayRef<Expr*> semantics () {
6718
- return ArrayRef ( semantics_begin (), semantics_end () );
6692
+ return getTrailingObjects ( getNumSubExprs ()). drop_front ( );
6719
6693
}
6720
6694
ArrayRef<const Expr*> semantics () const {
6721
- return ArrayRef ( semantics_begin (), semantics_end () );
6695
+ return getTrailingObjects ( getNumSubExprs ()). drop_front ( );
6722
6696
}
6723
6697
6724
6698
Expr *getSemanticExpr (unsigned index) {
6725
- assert (index + 1 < getNumSubExprs ());
6726
- return getSubExprsBuffer ()[index + 1 ];
6699
+ return getTrailingObjects (getNumSubExprs ())[index + 1 ];
6727
6700
}
6728
6701
const Expr *getSemanticExpr (unsigned index) const {
6729
6702
return const_cast <PseudoObjectExpr*>(this )->getSemanticExpr (index );
@@ -6748,7 +6721,7 @@ class PseudoObjectExpr final
6748
6721
}
6749
6722
const_child_range children () const {
6750
6723
Stmt *const *cs = const_cast <Stmt *const *>(
6751
- reinterpret_cast <const Stmt *const *>(getSubExprsBuffer ()));
6724
+ reinterpret_cast <const Stmt *const *>(getTrailingObjects ()));
6752
6725
return const_child_range (cs, cs + getNumSubExprs ());
6753
6726
}
6754
6727
0 commit comments