Add utility method for determining whether a function argument
authorDuncan Sands <baldrick@free.fr>
Fri, 11 Dec 2009 08:36:17 +0000 (08:36 +0000)
committerDuncan Sands <baldrick@free.fr>
Fri, 11 Dec 2009 08:36:17 +0000 (08:36 +0000)
has the 'nest' attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91109 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Argument.h
lib/VMCore/Function.cpp

index 3a846c28994dca84051ce1341a4e8e261a495b94..ca54f48c36f386ac1ea15ef55e31071e8d0b3905 100644 (file)
@@ -51,6 +51,10 @@ public:
   /// in its containing function.
   bool hasByValAttr() const;
 
+  /// hasNestAttr - Return true if this argument has the nest attribute on
+  /// it in its containing function.
+  bool hasNestAttr() const;
+
   /// hasNoAliasAttr - Return true if this argument has the noalias attribute on
   /// it in its containing function.
   bool hasNoAliasAttr() const;
index 6cf2c8186f9be09ecdf602ea85edad745d00a0c7..88e1fe8ae4f703abf5cae5d044fdba490cfafdec 100644 (file)
@@ -77,6 +77,13 @@ bool Argument::hasByValAttr() const {
   return getParent()->paramHasAttr(getArgNo()+1, Attribute::ByVal);
 }
 
+/// hasNestAttr - Return true if this argument has the nest attribute on
+/// it in its containing function.
+bool Argument::hasNestAttr() const {
+  if (!isa<PointerType>(getType())) return false;
+  return getParent()->paramHasAttr(getArgNo()+1, Attribute::Nest);
+}
+
 /// hasNoAliasAttr - Return true if this argument has the noalias attribute on
 /// it in its containing function.
 bool Argument::hasNoAliasAttr() const {