From 7d54254c9cc6e5a3be3a7d9d22241c0ae8a7fa03 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Sun, 17 Feb 2008 23:22:28 +0000 Subject: [PATCH] Add a predicate to Argument to check for the StructRet attribute. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47248 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Argument.h | 4 ++++ lib/VMCore/Function.cpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/include/llvm/Argument.h b/include/llvm/Argument.h index a9d85f21d09..23d1a083482 100644 --- a/include/llvm/Argument.h +++ b/include/llvm/Argument.h @@ -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); diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 47e85d7aa69..fe3f2fe770c 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -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(getType())) return false; + return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::StructRet); +} +