Add some convenience methods for querying function attributes.
authorBill Wendling <isanbard@gmail.com>
Mon, 18 Feb 2013 23:16:42 +0000 (23:16 +0000)
committerBill Wendling <isanbard@gmail.com>
Mon, 18 Feb 2013 23:16:42 +0000 (23:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175469 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Function.h

index f7d5a48d204d43ead91be2b02d8f267850e566fe..568b55c87b95db76a44dda2524380badd1f82aff 100644 (file)
@@ -175,6 +175,14 @@ public:
                                              AttributeSet::FunctionIndex, N));
   }
 
+  /// \brief Return true if the function has the attribute.
+  bool hasFnAttribute(Attribute::AttrKind Kind) const {
+    return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind);
+  }
+  bool hasFnAttribute(StringRef Kind) const {
+    return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind);
+  }
+
   /// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm
   ///                             to use during code generation.
   bool hasGC() const;