summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Argument.h4
-rw-r--r--lib/VMCore/Function.cpp7
2 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Argument.h b/include/llvm/Argument.h
index a9d85f21d0..23d1a08348 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 47e85d7aa6..fe3f2fe770 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<PointerType>(getType())) return false;
+ return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::StructRet);
+}
+