summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-16 05:55:09 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-16 05:55:09 +0000
commita5c699d5f7de7eb88b7f549539b6550653dea74e (patch)
treeb704c01bad9fc507df5cffc90e358a262c5cc8f8
parent46d5dd9b058f31637f2449b2925f13a5707d126d (diff)
downloadllvm-a5c699d5f7de7eb88b7f549539b6550653dea74e.tar.gz
llvm-a5c699d5f7de7eb88b7f549539b6550653dea74e.tar.bz2
llvm-a5c699d5f7de7eb88b7f549539b6550653dea74e.tar.xz
Have AttrBuilder defriend the Attributes class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166011 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Attributes.h3
-rw-r--r--lib/VMCore/Attributes.cpp6
2 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
index aac5d9ef4a..345277560f 100644
--- a/include/llvm/Attributes.h
+++ b/include/llvm/Attributes.h
@@ -192,7 +192,6 @@ public:
/// Builder's value, however, is not. So this can be used as a quick way to test
/// for equality, presence of attributes, etc.
class AttrBuilder {
- friend class Attributes;
uint64_t Bits;
public:
AttrBuilder() : Bits(0) {}
@@ -267,6 +266,8 @@ public:
.removeAttribute(Attributes::AddressSafety);
}
+ uint64_t Raw() const { return Bits; }
+
bool operator==(const AttrBuilder &B) {
return Bits == B.Bits;
}
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index f028fd356d..393eab0eef 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -38,13 +38,13 @@ Attributes Attributes::get(LLVMContext &Context, ArrayRef<AttrVal> Vals) {
Attributes Attributes::get(LLVMContext &Context, AttrBuilder &B) {
// If there are no attributes, return an empty Attributes class.
- if (B.Bits == 0)
+ if (!B.hasAttributes())
return Attributes();
// Otherwise, build a key to look up the existing attributes.
LLVMContextImpl *pImpl = Context.pImpl;
FoldingSetNodeID ID;
- ID.AddInteger(B.Bits);
+ ID.AddInteger(B.Raw());
void *InsertPoint;
AttributesImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
@@ -52,7 +52,7 @@ Attributes Attributes::get(LLVMContext &Context, AttrBuilder &B) {
if (!PA) {
// If we didn't find any existing attributes of the same shape then create a
// new one and insert it.
- PA = new AttributesImpl(B.Bits);
+ PA = new AttributesImpl(B.Raw());
pImpl->AttrsSet.InsertNode(PA, InsertPoint);
}