Convert to using the Attributes::Builder interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2012-10-09 00:01:21 +00:00
parent 9f11bf52b4
commit 8831c0605b
5 changed files with 47 additions and 16 deletions

View File

@@ -377,6 +377,10 @@ void Attributes::Builder::addStackAlignmentAttr(unsigned Align) {
Bits |= (Log2_32(Align) + 1) << 26;
}
void Attributes::Builder::removeAttributes(const Attributes &A) {
Bits &= ~A.Raw();
}
void Attributes::Builder::removeAddressSafetyAttr() {
Bits &= ~Attribute::AddressSafety_i;
}
@@ -463,6 +467,9 @@ void Attributes::Builder::removeStackAlignmentAttr() {
bool Attributes::Builder::hasAttributes() const {
return Bits != 0;
}
bool Attributes::Builder::hasAttributes(const Attributes &A) const {
return Bits & A.Raw();
}
bool Attributes::Builder::hasAlignmentAttr() const {
return Bits & Attribute::Alignment_i;
}
@@ -662,6 +669,15 @@ bool AttrListPtr::hasAttrSomewhere(Attributes Attr) const {
return false;
}
unsigned AttrListPtr::getNumAttrs() const {
return AttrList ? AttrList->Attrs.size() : 0;
}
Attributes &AttrListPtr::getAttributesAtIndex(unsigned i) const {
assert(AttrList && "Trying to get an attribute from an empty list!");
assert(i < AttrList->Attrs.size() && "Index out of range!");
return AttrList->Attrs[i].Attrs;
}
AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
Attributes OldAttrs = getAttributes(Idx);