1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Add an isSwiftError predicate to Value

llvm-svn: 281143
This commit is contained in:
Arnold Schwaighofer 2016-09-10 18:14:54 +00:00
parent 997810cad7
commit 8781da1527
2 changed files with 16 additions and 0 deletions

View File

@ -448,6 +448,12 @@ public:
/// \brief Return true if there is metadata referencing this value.
bool isUsedByMetadata() const { return IsUsedByMD; }
/// \brief Return true if this value is a swifterror value.
///
/// swifterror values can be either a function argument or an alloca with a
/// swifterror attribute.
bool isSwiftError() const;
/// \brief Strip off pointer casts, all-zero GEPs, and aliases.
///
/// Returns the original uncasted value. If this is called on a non-pointer

View File

@ -664,6 +664,16 @@ void Value::reverseUseList() {
Head->setPrev(&UseList);
}
bool Value::isSwiftError() const {
auto *Arg = dyn_cast<Argument>(this);
if (Arg)
return Arg->hasSwiftErrorAttr();
auto *Alloca = dyn_cast<AllocaInst>(this);
if (!Alloca)
return false;
return Alloca->isSwiftError();
}
//===----------------------------------------------------------------------===//
// ValueHandleBase Class
//===----------------------------------------------------------------------===//