summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-09-21 15:26:31 +0000
committerBill Wendling <isanbard@gmail.com>2012-09-21 15:26:31 +0000
commitef99fe8efaa6cb74c66e570a6ef467debca92911 (patch)
tree7104eabbeced03fe034edf2f391d04e63227e8fd /lib/VMCore
parent122f5e5a5b04e3c364d13913c14ee14f9b7ba387 (diff)
downloadllvm-ef99fe8efaa6cb74c66e570a6ef467debca92911.tar.gz
llvm-ef99fe8efaa6cb74c66e570a6ef467debca92911.tar.bz2
llvm-ef99fe8efaa6cb74c66e570a6ef467debca92911.tar.xz
Make the 'get*AlignmentFromAttr' functions into member functions within the Attributes class. Now with fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164370 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Attributes.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 3a87da44dd..af8163fd40 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -80,12 +80,12 @@ std::string Attributes::getAsString() const {
Result += "address_safety ";
if (hasStackAlignmentAttr()) {
Result += "alignstack(";
- Result += utostr(Attribute::getStackAlignmentFromAttrs(*this));
+ Result += utostr(getStackAlignment());
Result += ") ";
}
if (hasAlignmentAttr()) {
Result += "align ";
- Result += utostr(Attribute::getAlignmentFromAttrs(*this));
+ Result += utostr(getAlignment());
Result += " ";
}
// Trim the trailing space.
@@ -174,7 +174,7 @@ AttrListPtr AttrListPtr::get(ArrayRef<AttributeWithIndex> Attrs) {
#ifndef NDEBUG
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
- assert(Attrs[i].Attrs != Attribute::None &&
+ assert(Attrs[i].Attrs.hasAttributes() &&
"Pointless attribute!");
assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
"Misordered AttributesList!");
@@ -247,13 +247,14 @@ const AttributeWithIndex &AttrListPtr::getSlot(unsigned Slot) const {
/// returned. Attributes for the result are denoted with Idx = 0.
/// Function notes are denoted with idx = ~0.
Attributes AttrListPtr::getAttributes(unsigned Idx) const {
- if (AttrList == 0) return Attribute::None;
+ if (AttrList == 0) return Attributes();
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
if (Attrs[i].Index == Idx)
return Attrs[i].Attrs;
- return Attribute::None;
+
+ return Attributes();
}
/// hasAttrSomewhere - Return true if the specified attribute is set for at
@@ -274,8 +275,8 @@ AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment.
// For now, say we can't change a known alignment.
- unsigned OldAlign = Attribute::getAlignmentFromAttrs(OldAttrs);
- unsigned NewAlign = Attribute::getAlignmentFromAttrs(Attrs);
+ unsigned OldAlign = OldAttrs.getAlignment();
+ unsigned NewAlign = Attrs.getAlignment();
assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
"Attempt to change alignment!");
#endif