Use appropriate method calls to get the alignment value.
authorBill Wendling <isanbard@gmail.com>
Tue, 9 Oct 2012 20:28:54 +0000 (20:28 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 9 Oct 2012 20:28:54 +0000 (20:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165541 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Attributes.h
lib/VMCore/Attributes.cpp

index aa7bc32761a84e6e752c39ddf85f763512012a05..fcfacb12a55ed05f3d09d434bbf63428b1d2145b 100644 (file)
@@ -334,8 +334,7 @@ public:
     // bits.
     uint64_t EncodedAttrs = Attrs.Raw() & 0xffff;
     if (Attrs.hasAttribute(Attributes::Alignment))
-      EncodedAttrs |= (1ULL << 16) <<
-        (((Attrs.Raw() & Attribute::Alignment_i) - 1) >> 16);
+      EncodedAttrs |= Attrs.getAlignment() << 16;
     EncodedAttrs |= (Attrs.Raw() & (0xfffULL << 21)) << 11;
     return EncodedAttrs;
   }
index 45972635cb04dee9cf15206dab37d4332a06f7df..88f20e94a5c5f86623e5c2d8d46d5ac79642d884 100644 (file)
@@ -245,13 +245,14 @@ bool Attributes::Builder::hasAttributes(const Attributes &A) const {
   return Bits & A.Raw();
 }
 bool Attributes::Builder::hasAlignmentAttr() const {
-  return Bits & Attribute::Alignment_i;
+  return Bits & AttributesImpl::getAttrMask(Attributes::Alignment);
 }
 
 uint64_t Attributes::Builder::getAlignment() const {
   if (!hasAlignmentAttr())
     return 0;
-  return 1U << (((Bits & Attribute::Alignment_i) >> 16) - 1);
+  return 1U <<
+    (((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1);
 }
 
 //===----------------------------------------------------------------------===//
@@ -305,11 +306,11 @@ bool AttributesImpl::hasAttributes(const Attributes &A) const {
 }
 
 uint64_t AttributesImpl::getAlignment() const {
-  return Bits & Attribute::Alignment_i;
+  return Bits & getAttrMask(Attributes::Alignment);
 }
 
 uint64_t AttributesImpl::getStackAlignment() const {
-  return Bits & Attribute::StackAlignment_i;
+  return Bits & getAttrMask(Attributes::StackAlignment);
 }
 
 bool AttributesImpl::isEmptyOrSingleton() const {