Add a couple of accessor methods to get the kind and values of an attribute.
authorBill Wendling <isanbard@gmail.com>
Tue, 29 Jan 2013 20:45:34 +0000 (20:45 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 29 Jan 2013 20:45:34 +0000 (20:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173828 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Attributes.h
lib/IR/Attributes.cpp

index 1578789df605e6b2d2eca1066833a4dcff67c108..5ebb6296cd618c5045220066d73143dcb11ae935 100644 (file)
@@ -28,6 +28,7 @@ class AttrBuilder;
 class AttributeImpl;
 class AttributeSetImpl;
 class AttributeSetNode;
+class Constant;
 class LLVMContext;
 class Type;
 
@@ -130,6 +131,12 @@ public:
   /// \brief Return true if attributes exist
   bool hasAttributes() const;
 
+  /// \brief Return the kind of this attribute.
+  Constant *getAttributeKind() const;
+
+  /// \brief Return the value (if present) of the non-target-specific attribute.
+  ArrayRef<Constant*> getAttributeValues() const;
+
   /// \brief Returns the alignment field of an attribute as a byte alignment
   /// value.
   unsigned getAlignment() const;
index a3f62ae07648909cf14ca80a4e2230851ddfdba7..1a971109c22b5343b0aafcb3e9cd43a434986885 100644 (file)
@@ -83,6 +83,14 @@ bool Attribute::hasAttributes() const {
   return pImpl && pImpl->hasAttributes();
 }
 
+Constant *Attribute::getAttributeKind() const {
+  return pImpl ? pImpl->getAttributeKind() : 0;
+}
+
+ArrayRef<Constant*> Attribute::getAttributeValues() const {
+  return pImpl ? pImpl->getAttributeValues() : ArrayRef<Constant*>();
+}
+
 /// This returns the alignment field of an attribute as a byte alignment value.
 unsigned Attribute::getAlignment() const {
   if (!hasAttribute(Attribute::Alignment))