diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-15 13:13:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-15 13:13:32 +0000 |
commit | 2a72820b43b94a4da0d51c1533b22ded37fc5c86 (patch) | |
tree | 46af2bfca1539e40ab4eb7a5accd52c26eb65475 | |
parent | f84b9bc33b931e3fca3ad7d4c5c94e153c974273 (diff) |
Improve error messages on assertion failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@821 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Value.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/Value.h b/include/llvm/Value.h index ea17c3ef2e..aece4ce243 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -188,7 +188,10 @@ template <class X> class real_type <class UseTy<X> > { typedef X *Type; }; // if (isa<Type>(myVal)) { ... } // template <class X, class Y> -inline bool isa(Y Val) { return X::classof(Val); } +inline bool isa(Y Val) { + assert(Val && "isa<Ty>(NULL) invoked!"); + return X::classof(Val); +} // cast<X> - Return the argument parameter cast to the specified type. This @@ -201,7 +204,8 @@ inline bool isa(Y Val) { return X::classof(Val); } // template <class X, class Y> inline X *cast(Y Val) { - assert((Val == 0 || isa<X>(Val)) && "Invalid cast argument type!"); + assert((Val == 0 || isa<X>(Val)) && + "cast<Ty>() argument of uncompatible type!"); return (X*)(real_type<Y>::Type)Val; } |