@@ -1301,9 +1301,9 @@ AttributeList AttributeList::get(LLVMContext &C,
1301
1301
AttributeList
1302
1302
AttributeList::addAttributeAtIndex (LLVMContext &C, unsigned Index,
1303
1303
Attribute::AttrKind Kind) const {
1304
- if (hasAttributeAtIndex (Index, Kind))
1305
- return *this ;
1306
1304
AttributeSet Attrs = getAttributes (Index);
1305
+ if (Attrs.hasAttribute (Kind))
1306
+ return *this ;
1307
1307
// TODO: Insert at correct position and avoid sort.
1308
1308
SmallVector<Attribute, 8 > NewAttrs (Attrs.begin (), Attrs.end ());
1309
1309
NewAttrs.push_back (Attribute::get (C, Kind));
@@ -1379,19 +1379,19 @@ AttributeList AttributeList::addParamAttribute(LLVMContext &C,
1379
1379
AttributeList
1380
1380
AttributeList::removeAttributeAtIndex (LLVMContext &C, unsigned Index,
1381
1381
Attribute::AttrKind Kind) const {
1382
- if (!hasAttributeAtIndex (Index, Kind))
1382
+ AttributeSet Attrs = getAttributes (Index);
1383
+ if (!Attrs.hasAttribute (Kind))
1383
1384
return *this ;
1384
- return setAttributesAtIndex (C, Index,
1385
- getAttributes (Index).removeAttribute (C, Kind));
1385
+ return setAttributesAtIndex (C, Index, Attrs.removeAttribute (C, Kind));
1386
1386
}
1387
1387
1388
1388
AttributeList AttributeList::removeAttributeAtIndex (LLVMContext &C,
1389
1389
unsigned Index,
1390
1390
StringRef Kind) const {
1391
- if (!hasAttributeAtIndex (Index, Kind))
1391
+ AttributeSet Attrs = getAttributes (Index);
1392
+ if (!Attrs.hasAttribute (Kind))
1392
1393
return *this ;
1393
- return setAttributesAtIndex (C, Index,
1394
- getAttributes (Index).removeAttribute (C, Kind));
1394
+ return setAttributesAtIndex (C, Index, Attrs.removeAttribute (C, Kind));
1395
1395
}
1396
1396
1397
1397
AttributeList AttributeList::removeAttributesAtIndex (
0 commit comments