@@ -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,22 @@ 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>();
261-     llvm::uninitialized_copy (Val, TrailingCR);
256+     llvm::uninitialized_copy (Val, getTrailingObjects ());
262257  }
263258
264259  ~ConstantRangeListAttributeImpl () {
265-     ConstantRange *TrailingCR = getTrailingObjects<ConstantRange>();
266-     for  (unsigned  I = 0 ; I != Size; ++I)
267-       TrailingCR[I].~ConstantRange ();
260+     for  (ConstantRange &CR : getTrailingObjects (Size))
261+       CR.~ConstantRange ();
268262  }
269263
270264  ArrayRef<ConstantRange> getConstantRangeListValue () const  {
271-     return  ArrayRef ( getTrailingObjects<ConstantRange>(),  Size);
265+     return  getTrailingObjects ( Size);
272266  }
273267
274268  static  size_t  totalSizeToAlloc (ArrayRef<ConstantRange> Val) {
@@ -353,7 +347,7 @@ class AttributeSetNode final
353347
354348  using  iterator = const  Attribute *;
355349
356-   iterator begin () const  { return  getTrailingObjects<Attribute> (); }
350+   iterator begin () const  { return  getTrailingObjects (); }
357351  iterator end () const  { return  begin () + NumAttrs; }
358352
359353  void  Profile (FoldingSetNodeID &ID) const  {
@@ -383,9 +377,6 @@ class AttributeListImpl final
383377  // / Union of enum attributes available at any index.
384378  AttributeBitSet AvailableSomewhereAttrs;
385379
386-   //  Helper fn for TrailingObjects class.
387-   size_t  numTrailingObjects (OverloadToken<AttributeSet>) { return  NumAttrSets; }
388- 
389380public: 
390381  AttributeListImpl (ArrayRef<AttributeSet> Sets);
391382
@@ -407,7 +398,7 @@ class AttributeListImpl final
407398
408399  using  iterator = const  AttributeSet *;
409400
410-   iterator begin () const  { return  getTrailingObjects<AttributeSet> (); }
401+   iterator begin () const  { return  getTrailingObjects (); }
411402  iterator end () const  { return  begin () + NumAttrSets; }
412403
413404  void  Profile (FoldingSetNodeID &ID) const ;
0 commit comments