@@ -195,15 +195,12 @@ class StringAttributeImpl final
195195
196196  unsigned  KindSize;
197197  unsigned  ValSize;
198-   size_t  numTrailingObjects (OverloadToken<char >) const  {
199-     return  KindSize + 1  + ValSize + 1 ;
200-   }
201198
202199public: 
203200  StringAttributeImpl (StringRef Kind, StringRef Val = StringRef())
204201      : AttributeImpl(StringAttrEntry), KindSize(Kind.size()),
205202        ValSize (Val.size()) {
206-     char  *TrailingString = getTrailingObjects< char > ();
203+     char  *TrailingString = getTrailingObjects ();
207204    //  Some users rely on zero-termination.
208205    llvm::copy (Kind, TrailingString);
209206    TrailingString[KindSize] = ' \0 '  ;
@@ -212,10 +209,10 @@ class StringAttributeImpl final
212209  }
213210
214211  StringRef getStringKind () const  {
215-     return  StringRef (getTrailingObjects< char > (), KindSize);
212+     return  StringRef (getTrailingObjects (), KindSize);
216213  }
217214  StringRef getStringValue () const  {
218-     return  StringRef (getTrailingObjects< char > () + KindSize + 1 , ValSize);
215+     return  StringRef (getTrailingObjects () + KindSize + 1 , ValSize);
219216  }
220217
221218  static  size_t  totalSizeToAlloc (StringRef Kind, StringRef Val) {
@@ -250,25 +247,23 @@ class ConstantRangeListAttributeImpl final
250247  friend  TrailingObjects;
251248
252249  unsigned  Size;
253-   size_t  numTrailingObjects (OverloadToken<ConstantRange>) const  { return  Size; }
254250
255251public: 
256252  ConstantRangeListAttributeImpl (Attribute::AttrKind Kind,
257253                                 ArrayRef<ConstantRange> Val)
258254      : EnumAttributeImpl(ConstantRangeListAttrEntry, Kind), Size(Val.size()) {
259255    assert (Size > 0 );
260-     ConstantRange *TrailingCR = getTrailingObjects<ConstantRange> ();
256+     ConstantRange *TrailingCR = getTrailingObjects ();
261257    std::uninitialized_copy (Val.begin (), Val.end (), TrailingCR);
262258  }
263259
264260  ~ConstantRangeListAttributeImpl () {
265-     ConstantRange *TrailingCR = getTrailingObjects<ConstantRange>();
266-     for  (unsigned  I = 0 ; I != Size; ++I)
267-       TrailingCR[I].~ConstantRange ();
261+     for  (ConstantRange &CR : getTrailingObjects (Size))
262+       CR.~ConstantRange ();
268263  }
269264
270265  ArrayRef<ConstantRange> getConstantRangeListValue () const  {
271-     return  ArrayRef ( getTrailingObjects<ConstantRange>(),  Size);
266+     return  getTrailingObjects ( Size);
272267  }
273268
274269  static  size_t  totalSizeToAlloc (ArrayRef<ConstantRange> Val) {
@@ -353,7 +348,7 @@ class AttributeSetNode final
353348
354349  using  iterator = const  Attribute *;
355350
356-   iterator begin () const  { return  getTrailingObjects<Attribute> (); }
351+   iterator begin () const  { return  getTrailingObjects (); }
357352  iterator end () const  { return  begin () + NumAttrs; }
358353
359354  void  Profile (FoldingSetNodeID &ID) const  {
@@ -383,9 +378,6 @@ class AttributeListImpl final
383378  // / Union of enum attributes available at any index.
384379  AttributeBitSet AvailableSomewhereAttrs;
385380
386-   //  Helper fn for TrailingObjects class.
387-   size_t  numTrailingObjects (OverloadToken<AttributeSet>) { return  NumAttrSets; }
388- 
389381public: 
390382  AttributeListImpl (ArrayRef<AttributeSet> Sets);
391383
@@ -407,7 +399,7 @@ class AttributeListImpl final
407399
408400  using  iterator = const  AttributeSet *;
409401
410-   iterator begin () const  { return  getTrailingObjects<AttributeSet> (); }
402+   iterator begin () const  { return  getTrailingObjects (); }
411403  iterator end () const  { return  begin () + NumAttrSets; }
412404
413405  void  Profile (FoldingSetNodeID &ID) const ;
0 commit comments