Add a predicate to Argument to check for the StructRet attribute.
authorOwen Anderson <resistor@mac.com>
Sun, 17 Feb 2008 23:22:28 +0000 (23:22 +0000)
committerOwen Anderson <resistor@mac.com>
Sun, 17 Feb 2008 23:22:28 +0000 (23:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47248 91177308-0d34-0410-b5e6-96231b3b80d8

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

index a9d85f21d091fdfb525080f12ecc2501b7f28987..23d1a083482499ccbb064abc3778282e94ac4260 100644 (file)
@@ -57,6 +57,10 @@ public:
   /// it in its containing function.
   bool hasNoAliasAttr() const;
   
+  /// hasSRetAttr - Return true if this argument has the sret attribute on it in
+  /// its containing function.
+  bool hasStructRetAttr() const;
+  
   virtual void print(std::ostream &OS) const;
   void print(std::ostream *OS) const {
     if (OS) print(*OS);
index 47e85d7aa693a9c28e98d78e819a2464ea62f284..fe3f2fe770cceddf070b89afdf541b0be3129067 100644 (file)
@@ -103,6 +103,13 @@ bool Argument::hasNoAliasAttr() const {
   return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::NoAlias);
 }
 
+/// hasSRetAttr - Return true if this argument has the sret attribute on
+/// it in its containing function.
+bool Argument::hasStructRetAttr() const {
+  if (!isa<PointerType>(getType())) return false;
+  return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::StructRet);
+}
+