Remove the bitwise NOT operator from the Attributes class. Replace it with the equivalent from the builder class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165892 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2012-10-14 06:39:53 +00:00
parent a19a53065f
commit 5886b7bfc8
7 changed files with 35 additions and 22 deletions

View File

@@ -110,9 +110,6 @@ Attributes &Attributes::operator &= (const Attributes &A) {
Attrs.Bits &= A.Raw();
return *this;
}
Attributes Attributes::operator ~ () const {
return Attributes(~Raw());
}
uint64_t Attributes::Raw() const {
return Attrs.Bits;
@@ -242,8 +239,10 @@ removeAttribute(Attributes::AttrVal Val) {
return *this;
}
void Attributes::Builder::removeAttributes(const Attributes &A) {
Attributes::Builder &Attributes::Builder::
removeAttributes(const Attributes &A) {
Bits &= ~A.Raw();
return *this;
}
bool Attributes::Builder::hasAttribute(Attributes::AttrVal A) const {
@@ -548,7 +547,8 @@ AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
return get(NewAttrList);
}
AttrListPtr AttrListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
AttrListPtr AttrListPtr::removeAttr(LLVMContext &C, unsigned Idx,
Attributes Attrs) const {
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment.
// For now, say we can't pass in alignment, which no current use does.
@@ -558,8 +558,9 @@ AttrListPtr AttrListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
if (AttrList == 0) return AttrListPtr();
Attributes OldAttrs = getAttributes(Idx);
Attributes NewAttrs = OldAttrs & ~Attrs;
if (NewAttrs == OldAttrs)
Attributes::Builder NewAttrs =
Attributes::Builder(OldAttrs).removeAttributes(Attrs);
if (NewAttrs == Attributes::Builder(OldAttrs))
return *this;
SmallVector<AttributeWithIndex, 8> NewAttrList;
@@ -572,7 +573,8 @@ AttrListPtr AttrListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
// If there are attributes already at this index, merge them in.
assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
Attrs = OldAttrList[i].Attrs & ~Attrs;
Attrs = Attributes::get(C, Attributes::Builder(OldAttrList[i].Attrs).
removeAttributes(Attrs));
++i;
if (Attrs) // If any attributes left for this parameter, add them.
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));