mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Use iterators instead of relying upon a bitmask of attributes to remove attributes from an AttrBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174123 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -749,7 +749,7 @@ AttributeSet::iterator AttributeSet::begin(unsigned Idx) {
|
|||||||
AttributeSet::iterator AttributeSet::end(unsigned Idx) {
|
AttributeSet::iterator AttributeSet::end(unsigned Idx) {
|
||||||
if (!pImpl)
|
if (!pImpl)
|
||||||
return ArrayRef<Attribute>().end();
|
return ArrayRef<Attribute>().end();
|
||||||
return pImpl->begin(Idx);
|
return pImpl->end(Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -852,18 +852,24 @@ AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrKind Val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AttrBuilder &AttrBuilder::removeAttributes(AttributeSet A, uint64_t Index) {
|
AttrBuilder &AttrBuilder::removeAttributes(AttributeSet A, uint64_t Index) {
|
||||||
uint64_t Mask = A.Raw(Index);
|
unsigned Idx = ~0U;
|
||||||
|
for (unsigned I = 0, E = A.getNumSlots(); I != E; ++I)
|
||||||
for (Attribute::AttrKind I = Attribute::None; I != Attribute::EndAttrKinds;
|
if (A.getSlotIndex(I) == Index) {
|
||||||
I = Attribute::AttrKind(I + 1)) {
|
Idx = I;
|
||||||
if (Mask & AttributeImpl::getAttrMask(I)) {
|
break;
|
||||||
Attrs.erase(I);
|
|
||||||
|
|
||||||
if (I == Attribute::Alignment)
|
|
||||||
Alignment = 0;
|
|
||||||
else if (I == Attribute::StackAlignment)
|
|
||||||
StackAlignment = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(Idx != ~0U && "Couldn't find index in AttributeSet!");
|
||||||
|
|
||||||
|
for (AttributeSet::iterator I = A.begin(Idx), E = A.end(Idx); I != E; ++I) {
|
||||||
|
ConstantInt *CI = cast<ConstantInt>(I->getAttributeKind());
|
||||||
|
Attribute::AttrKind Kind = Attribute::AttrKind(CI->getZExtValue());
|
||||||
|
Attrs.erase(Kind);
|
||||||
|
|
||||||
|
if (Kind == Attribute::Alignment)
|
||||||
|
Alignment = 0;
|
||||||
|
else if (Kind == Attribute::StackAlignment)
|
||||||
|
StackAlignment = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
Reference in New Issue
Block a user