summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-15 06:53:28 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-15 06:53:28 +0000
commitad4643f54ba52d1f93426a9853934df8ce3271a0 (patch)
tree4dcc011f3a2b2ef6e3792a189f84c798ce014fd7 /include/llvm
parent2c6893b56817ceb51a523a5d1342fc2317efe251 (diff)
downloadllvm-ad4643f54ba52d1f93426a9853934df8ce3271a0.tar.gz
llvm-ad4643f54ba52d1f93426a9853934df8ce3271a0.tar.bz2
llvm-ad4643f54ba52d1f93426a9853934df8ce3271a0.tar.xz
Use a ::get method to create the attribute from Attributes::AttrVals instead of a constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Attributes.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
index afb2e564f0..d0833c3b3f 100644
--- a/include/llvm/Attributes.h
+++ b/include/llvm/Attributes.h
@@ -89,17 +89,26 @@ public:
};
private:
AttributesImpl *Attrs;
-
- explicit Attributes(AttributesImpl *A);
+ Attributes(AttributesImpl *A);
public:
Attributes() : Attrs(0) {}
- explicit Attributes(LLVMContext &C, ArrayRef<AttrVal> Vals);
Attributes(const Attributes &A);
Attributes &operator=(const Attributes &A) {
Attrs = A.Attrs;
return *this;
}
+ /// get - Return a uniquified Attributes object. This takes the uniquified
+ /// value from the Builder and wraps it in the Attributes class.
+ class Builder;
+ static Attributes get(LLVMContext &Context, ArrayRef<AttrVal> Vals);
+ static Attributes get(LLVMContext &Context, Builder &B);
+
+ //===--------------------------------------------------------------------===//
+ /// Attributes::Builder - This class is used in conjunction with the
+ /// Attributes::get method to create an Attributes object. The object itself
+ /// is uniquified. The Builder's value, however, is not. So this can be used
+ /// as a quick way to test for equality, presence of attributes, etc.
class Builder {
friend class Attributes;
uint64_t Bits;
@@ -122,6 +131,9 @@ public:
Builder &addAttribute(Attributes::AttrVal Val);
Builder &removeAttribute(Attributes::AttrVal Val);
+ Builder &addAttributes(const Attributes &A);
+ Builder &removeAttributes(const Attributes &A);
+
/// addRawValue - Add the raw value to the internal representation. This
/// should be used ONLY for decoding bitcode!
Builder &addRawValue(uint64_t Val);
@@ -134,9 +146,6 @@ public:
/// a power of 2) into the form used internally in Attributes.
Builder &addStackAlignmentAttr(unsigned Align);
- Builder &addAttributes(const Attributes &A);
- Builder &removeAttributes(const Attributes &A);
-
/// @brief Remove attributes that are used on functions only.
void removeFunctionOnlyAttrs() {
removeAttribute(Attributes::NoReturn)
@@ -167,10 +176,6 @@ public:
}
};
- /// get - Return a uniquified Attributes object. This takes the uniquified
- /// value from the Builder and wraps it in the Attributes class.
- static Attributes get(LLVMContext &Context, Builder &B);
-
/// @brief Return true if the attribute is present.
bool hasAttribute(AttrVal Val) const;
@@ -224,10 +229,10 @@ public:
hasAttribute(Attributes::AddressSafety);
}
- bool operator == (const Attributes &A) const {
+ bool operator==(const Attributes &A) const {
return Attrs == A.Attrs;
}
- bool operator != (const Attributes &A) const {
+ bool operator!=(const Attributes &A) const {
return Attrs != A.Attrs;
}