/// a power of 2) into the form used internally in Attributes.
Builder &addStackAlignmentAttr(unsigned Align);
+ Builder &addAttributes(const Attributes &A);
Builder &removeAttributes(const Attributes &A);
/// @brief Remove attributes that are used on functions only.
return Attrs.Bits != A.Attrs.Bits;
}
- Attributes operator | (const Attributes &A) const;
Attributes operator & (const Attributes &A) const;
Attributes &operator |= (const Attributes &A);
Attributes &operator &= (const Attributes &A);
return Attrs.isEmptyOrSingleton();
}
-Attributes Attributes::operator | (const Attributes &A) const {
- return Attributes(Raw() | A.Raw());
-}
Attributes Attributes::operator & (const Attributes &A) const {
return Attributes(Raw() & A.Raw());
}
return *this;
}
-Attributes::Builder &Attributes::Builder::
-removeAttributes(const Attributes &A) {
+Attributes::Builder &Attributes::Builder::addAttributes(const Attributes &A) {
+ Bits |= A.Raw();
+ return *this;
+}
+
+Attributes::Builder &Attributes::Builder::removeAttributes(const Attributes &A){
Bits &= ~A.Raw();
return *this;
}
"Attempt to change alignment!");
#endif
- Attributes NewAttrs = OldAttrs | Attrs;
- if (NewAttrs == OldAttrs)
+ Attributes::Builder NewAttrs =
+ Attributes::Builder(OldAttrs).addAttributes(Attrs);
+ if (NewAttrs == Attributes::Builder(OldAttrs))
return *this;
SmallVector<AttributeWithIndex, 8> NewAttrList;