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
This commit is contained in:
Owen Anderson 2008-02-17 23:22:28 +00:00
parent 9b636cb338
commit 7d54254c9c
2 changed files with 11 additions and 0 deletions

View 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);

View 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);
}