From ad83002243b385b991123554ec1254ab255865e3 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Sat, 10 Sep 2016 18:14:54 +0000 Subject: Add an isSwiftError predicate to Value llvm-svn: 281143 --- llvm/lib/IR/Value.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/IR/Value.cpp') diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index be704a778a8..a1dfb37bf90 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -664,6 +664,16 @@ void Value::reverseUseList() { Head->setPrev(&UseList); } +bool Value::isSwiftError() const { + auto *Arg = dyn_cast(this); + if (Arg) + return Arg->hasSwiftErrorAttr(); + auto *Alloca = dyn_cast(this); + if (!Alloca) + return false; + return Alloca->isSwiftError(); +} + //===----------------------------------------------------------------------===// // ValueHandleBase Class //===----------------------------------------------------------------------===// -- cgit v1.2.3