@@ -195,15 +195,12 @@ class StringAttributeImpl final
195
195
196
196
unsigned KindSize;
197
197
unsigned ValSize;
198
- size_t numTrailingObjects (OverloadToken<char >) const {
199
- return KindSize + 1 + ValSize + 1 ;
200
- }
201
198
202
199
public:
203
200
StringAttributeImpl (StringRef Kind, StringRef Val = StringRef())
204
201
: AttributeImpl(StringAttrEntry), KindSize(Kind.size()),
205
202
ValSize (Val.size()) {
206
- char *TrailingString = getTrailingObjects< char > ();
203
+ char *TrailingString = getTrailingObjects ();
207
204
// Some users rely on zero-termination.
208
205
llvm::copy (Kind, TrailingString);
209
206
TrailingString[KindSize] = ' \0 ' ;
@@ -212,10 +209,10 @@ class StringAttributeImpl final
212
209
}
213
210
214
211
StringRef getStringKind () const {
215
- return StringRef (getTrailingObjects< char > (), KindSize);
212
+ return StringRef (getTrailingObjects (), KindSize);
216
213
}
217
214
StringRef getStringValue () const {
218
- return StringRef (getTrailingObjects< char > () + KindSize + 1 , ValSize);
215
+ return StringRef (getTrailingObjects () + KindSize + 1 , ValSize);
219
216
}
220
217
221
218
static size_t totalSizeToAlloc (StringRef Kind, StringRef Val) {
@@ -250,25 +247,22 @@ class ConstantRangeListAttributeImpl final
250
247
friend TrailingObjects;
251
248
252
249
unsigned Size ;
253
- size_t numTrailingObjects (OverloadToken<ConstantRange>) const { return Size ; }
254
250
255
251
public:
256
252
ConstantRangeListAttributeImpl (Attribute::AttrKind Kind,
257
253
ArrayRef<ConstantRange> Val)
258
254
: EnumAttributeImpl(ConstantRangeListAttrEntry, Kind), Size (Val.size()) {
259
255
assert (Size > 0 );
260
- ConstantRange *TrailingCR = getTrailingObjects<ConstantRange>();
261
- llvm::uninitialized_copy (Val, TrailingCR);
256
+ llvm::uninitialized_copy (Val, getTrailingObjects ());
262
257
}
263
258
264
259
~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 ();
268
262
}
269
263
270
264
ArrayRef<ConstantRange> getConstantRangeListValue () const {
271
- return ArrayRef ( getTrailingObjects<ConstantRange>(), Size );
265
+ return getTrailingObjects ( Size );
272
266
}
273
267
274
268
static size_t totalSizeToAlloc (ArrayRef<ConstantRange> Val) {
@@ -353,7 +347,7 @@ class AttributeSetNode final
353
347
354
348
using iterator = const Attribute *;
355
349
356
- iterator begin () const { return getTrailingObjects<Attribute> (); }
350
+ iterator begin () const { return getTrailingObjects (); }
357
351
iterator end () const { return begin () + NumAttrs; }
358
352
359
353
void Profile (FoldingSetNodeID &ID) const {
@@ -383,9 +377,6 @@ class AttributeListImpl final
383
377
// / Union of enum attributes available at any index.
384
378
AttributeBitSet AvailableSomewhereAttrs;
385
379
386
- // Helper fn for TrailingObjects class.
387
- size_t numTrailingObjects (OverloadToken<AttributeSet>) { return NumAttrSets; }
388
-
389
380
public:
390
381
AttributeListImpl (ArrayRef<AttributeSet> Sets);
391
382
@@ -407,7 +398,7 @@ class AttributeListImpl final
407
398
408
399
using iterator = const AttributeSet *;
409
400
410
- iterator begin () const { return getTrailingObjects<AttributeSet> (); }
401
+ iterator begin () const { return getTrailingObjects (); }
411
402
iterator end () const { return begin () + NumAttrSets; }
412
403
413
404
void Profile (FoldingSetNodeID &ID) const ;
0 commit comments