Convert getAttributes() to return an AttributeSetNode.
The AttributeSetNode contains all of the attributes. This removes one (hopefully
last) use of the Attribute class as a container of multiple attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173761 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h
index 34754e8..91f5005 100644
--- a/lib/IR/AttributeImpl.h
+++ b/lib/IR/AttributeImpl.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/FoldingSet.h"
#include "llvm/IR/Attributes.h"
+#include <string>
namespace llvm {
@@ -92,6 +93,13 @@
public:
static AttributeSetNode *get(LLVMContext &C, ArrayRef<Attribute> Attrs);
+ bool hasAttribute(Attribute::AttrKind Kind) const;
+ bool hasAttributes() const { return !AttrList.empty(); }
+
+ unsigned getAlignment() const;
+ unsigned getStackAlignment() const;
+ std::string getAsString() const;
+
typedef SmallVectorImpl<Attribute>::iterator iterator;
typedef SmallVectorImpl<Attribute>::const_iterator const_iterator;
@@ -152,6 +160,12 @@
return AttributeSet::get(Context, AttrNodes[Slot]);
}
+ /// \brief Retrieve the attribute set node for the given "slot" in the
+ /// AttrNode list.
+ AttributeSetNode *getSlotNode(unsigned Slot) const {
+ return AttrNodes[Slot].second;
+ }
+
typedef AttributeSetNode::iterator iterator;
typedef AttributeSetNode::const_iterator const_iterator;