summaryrefslogtreecommitdiff
path: root/include/llvm/Attributes.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-14 04:10:01 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-14 04:10:01 +0000
commita19a53065fcaa6fafce902efde38fcae7b0bdea4 (patch)
treef29295c60f996690e088112664d7474ee99596f2 /include/llvm/Attributes.h
parentda3f9d8edc5b3e0a3e0b94257c63e24215a85653 (diff)
downloadllvm-a19a53065fcaa6fafce902efde38fcae7b0bdea4.tar.gz
llvm-a19a53065fcaa6fafce902efde38fcae7b0bdea4.tar.bz2
llvm-a19a53065fcaa6fafce902efde38fcae7b0bdea4.tar.xz
Decode the LLVM attributes from bitcode using the attributes builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Attributes.h')
-rw-r--r--include/llvm/Attributes.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
index eb1798fb5e..ce477c8aeb 100644
--- a/include/llvm/Attributes.h
+++ b/include/llvm/Attributes.h
@@ -103,6 +103,7 @@ public:
uint64_t Bits;
public:
Builder() : Bits(0) {}
+ explicit Builder(uint64_t B) : Bits(B) {}
Builder(const Attributes &A) : Bits(A.Raw()) {}
void clear() { Bits = 0; }
@@ -118,6 +119,10 @@ public:
Builder &addAttribute(Attributes::AttrVal Val);
Builder &removeAttribute(Attributes::AttrVal Val);
+ /// addRawValue - Add the raw value to the internal representation. This
+ /// should be used ONLY for decoding bitcode!
+ Builder &addRawValue(uint64_t Val);
+
/// addAlignmentAttr - This turns an int alignment (which must be a power of
/// 2) into the form used internally in Attributes.
Builder &addAlignmentAttr(unsigned Align);
@@ -266,14 +271,11 @@ public:
assert((!Alignment || isPowerOf2_32(Alignment)) &&
"Alignment must be a power of two.");
- Attributes Attrs(EncodedAttrs & 0xffff);
- if (Alignment) {
- Attributes::Builder B;
+ Attributes::Builder B(EncodedAttrs & 0xffff);
+ if (Alignment)
B.addAlignmentAttr(Alignment);
- Attrs |= Attributes::get(B);
- }
- Attrs |= Attributes((EncodedAttrs & (0xfffULL << 32)) >> 11);
- return Attrs;
+ B.addRawValue((EncodedAttrs & (0xfffULL << 32)) >> 11);
+ return Attributes::get(B);
}
/// getAsString - The set of Attributes set in Attributes is converted to a