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:
parent
997810cad7
commit
8781da1527
@ -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
|
||||
|
@ -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
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user