[llvm] r173828 - Add a couple of accessor methods to get the kind and values of an attribute.

Bill Wendling isanbard at gmail.com
Tue Jan 29 12:45:34 PST 2013


Author: void
Date: Tue Jan 29 14:45:34 2013
New Revision: 173828

URL: http://llvm.org/viewvc/llvm-project?rev=173828&view=rev
Log:
Add a couple of accessor methods to get the kind and values of an attribute.

Modified:
    llvm/trunk/include/llvm/IR/Attributes.h
    llvm/trunk/lib/IR/Attributes.cpp

Modified: llvm/trunk/include/llvm/IR/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=173828&r1=173827&r2=173828&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Attributes.h (original)
+++ llvm/trunk/include/llvm/IR/Attributes.h Tue Jan 29 14:45:34 2013
@@ -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;

Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=173828&r1=173827&r2=173828&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Tue Jan 29 14:45:34 2013
@@ -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))





More information about the llvm-commits mailing list