aboutsummaryrefslogtreecommitdiffstats
path: root/lib/IR/AttributeImpl.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-24 00:06:56 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-24 00:06:56 +0000
commit3467e30edf63b6d8a8d446186674ba9e4b7885a9 (patch)
treee4cd1b684be7e3a46852382a219a859d8d4217f6 /lib/IR/AttributeImpl.h
parenta8ab5fc772e1eaaa1066d1c9c4135ac875d79365 (diff)
downloadexternal_llvm-3467e30edf63b6d8a8d446186674ba9e4b7885a9.zip
external_llvm-3467e30edf63b6d8a8d446186674ba9e4b7885a9.tar.gz
external_llvm-3467e30edf63b6d8a8d446186674ba9e4b7885a9.tar.bz2
Create a new class: AttributeSetNode.
This is a helper class for the AttributeSetImpl class. It holds a set of attributes that apply to a single element: function, return type, or parameter. These are uniqued. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/AttributeImpl.h')
-rw-r--r--lib/IR/AttributeImpl.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h
index 0843fd8..b02cc8b 100644
--- a/lib/IR/AttributeImpl.h
+++ b/lib/IR/AttributeImpl.h
@@ -56,6 +56,8 @@ public:
bool operator==(StringRef Kind) const;
bool operator!=(StringRef Kind) const;
+ bool operator<(const AttributeImpl &AI) const;
+
uint64_t Raw() const; // FIXME: Remove.
static uint64_t getAttrMask(Attribute::AttrKind Val);
@@ -69,7 +71,38 @@ public:
//===----------------------------------------------------------------------===//
/// \class
-/// \brief This class represents a set of attributes.
+/// \brief This class represents a group of attributes that apply to one
+/// element: function, return type, or parameter.
+class AttributeSetNode : public FoldingSetNode {
+ SmallVector<Attribute, 4> AttrList;
+
+ AttributeSetNode(ArrayRef<Attribute> Attrs)
+ : AttrList(Attrs.begin(), Attrs.end()) {}
+public:
+ static AttributeSetNode *get(LLVMContext &C, ArrayRef<Attribute> Attrs);
+
+ typedef SmallVectorImpl<Attribute>::iterator iterator;
+ typedef SmallVectorImpl<Attribute>::const_iterator const_iterator;
+
+ iterator begin() { return AttrList.begin(); }
+ iterator end() { return AttrList.end(); }
+
+ const_iterator begin() const { return AttrList.begin(); }
+ const_iterator end() const { return AttrList.end(); }
+
+ void Profile(FoldingSetNodeID &ID) const {
+ Profile(ID, AttrList);
+ }
+ static void Profile(FoldingSetNodeID &ID, ArrayRef<Attribute> AttrList) {
+ for (unsigned I = 0, E = AttrList.size(); I != E; ++I)
+ AttrList[I].Profile(ID);
+ }
+};
+
+//===----------------------------------------------------------------------===//
+/// \class
+/// \brief This class represents a set of attributes that apply to the function,
+/// return type, and parameters.
class AttributeSetImpl : public FoldingSetNode {
LLVMContext &Context;
SmallVector<AttributeWithIndex, 4> AttrList;