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

llvm-svn: 165894
This commit is contained in:
Bill Wendling 2012-10-14 07:17:34 +00:00
parent a05b043c4a
commit 5c407ed3ab
2 changed files with 10 additions and 8 deletions

View File

@ -131,6 +131,7 @@ public:
/// a power of 2) into the form used internally in Attributes. /// a power of 2) into the form used internally in Attributes.
Builder &addStackAlignmentAttr(unsigned Align); Builder &addStackAlignmentAttr(unsigned Align);
Builder &addAttributes(const Attributes &A);
Builder &removeAttributes(const Attributes &A); Builder &removeAttributes(const Attributes &A);
/// @brief Remove attributes that are used on functions only. /// @brief Remove attributes that are used on functions only.
@ -234,7 +235,6 @@ public:
return Attrs.Bits != A.Attrs.Bits; return Attrs.Bits != A.Attrs.Bits;
} }
Attributes operator | (const Attributes &A) const;
Attributes operator & (const Attributes &A) const; Attributes operator & (const Attributes &A) const;
Attributes &operator |= (const Attributes &A); Attributes &operator |= (const Attributes &A);
Attributes &operator &= (const Attributes &A); Attributes &operator &= (const Attributes &A);

View File

@ -93,9 +93,6 @@ bool Attributes::isEmptyOrSingleton() const {
return Attrs.isEmptyOrSingleton(); return Attrs.isEmptyOrSingleton();
} }
Attributes Attributes::operator | (const Attributes &A) const {
return Attributes(Raw() | A.Raw());
}
Attributes Attributes::operator & (const Attributes &A) const { Attributes Attributes::operator & (const Attributes &A) const {
return Attributes(Raw() & A.Raw()); return Attributes(Raw() & A.Raw());
} }
@ -236,8 +233,12 @@ removeAttribute(Attributes::AttrVal Val) {
return *this; return *this;
} }
Attributes::Builder &Attributes::Builder:: Attributes::Builder &Attributes::Builder::addAttributes(const Attributes &A) {
removeAttributes(const Attributes &A) { Bits |= A.Raw();
return *this;
}
Attributes::Builder &Attributes::Builder::removeAttributes(const Attributes &A){
Bits &= ~A.Raw(); Bits &= ~A.Raw();
return *this; return *this;
} }
@ -514,8 +515,9 @@ AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
"Attempt to change alignment!"); "Attempt to change alignment!");
#endif #endif
Attributes NewAttrs = OldAttrs | Attrs; Attributes::Builder NewAttrs =
if (NewAttrs == OldAttrs) Attributes::Builder(OldAttrs).addAttributes(Attrs);
if (NewAttrs == Attributes::Builder(OldAttrs))
return *this; return *this;
SmallVector<AttributeWithIndex, 8> NewAttrList; SmallVector<AttributeWithIndex, 8> NewAttrList;