Provide convenient access to the zext/sext attributes of function arguments. NFC.

llvm-svn: 214843
This commit is contained in:
Juergen Ributzka 2014-08-05 05:43:41 +00:00
parent fc6de428c8
commit 384c3b5c03
2 changed files with 22 additions and 0 deletions

View File

@ -105,6 +105,14 @@ public:
/// its containing function.
bool hasInAllocaAttr() const;
/// \brief Return true if this argument has the zext attribute on it in its
/// containing function.
bool hasZExtAttr() const;
/// \brief Return true if this argument has the sext attribute on it in its
/// containing function.
bool hasSExtAttr() const;
/// \brief Add a Attribute to an argument.
void addAttr(AttributeSet AS);

View File

@ -166,6 +166,20 @@ bool Argument::hasReturnedAttr() const {
hasAttribute(getArgNo()+1, Attribute::Returned);
}
/// hasZExtAttr - Return true if this argument has the zext attribute on it in
/// its containing function.
bool Argument::hasZExtAttr() const {
return getParent()->getAttributes().
hasAttribute(getArgNo()+1, Attribute::ZExt);
}
/// hasSExtAttr Return true if this argument has the sext attribute on it in its
/// containing function.
bool Argument::hasSExtAttr() const {
return getParent()->getAttributes().
hasAttribute(getArgNo()+1, Attribute::SExt);
}
/// Return true if this argument has the readonly or readnone attribute on it
/// in its containing function.
bool Argument::onlyReadsMemory() const {