From b66d7f541661b654effbbc44f347754c644776e0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 15 Oct 2001 13:13:32 +0000 Subject: [PATCH] Improve error messages on assertion failure. llvm-svn: 821 --- include/llvm/Value.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/llvm/Value.h b/include/llvm/Value.h index ea17c3ef2ec..aece4ce2439 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -188,7 +188,10 @@ template class real_type > { typedef X *Type; }; // if (isa(myVal)) { ... } // template -inline bool isa(Y Val) { return X::classof(Val); } +inline bool isa(Y Val) { + assert(Val && "isa(NULL) invoked!"); + return X::classof(Val); +} // cast - Return the argument parameter cast to the specified type. This @@ -201,7 +204,8 @@ inline bool isa(Y Val) { return X::classof(Val); } // template inline X *cast(Y Val) { - assert((Val == 0 || isa(Val)) && "Invalid cast argument type!"); + assert((Val == 0 || isa(Val)) && + "cast() argument of uncompatible type!"); return (X*)(real_type::Type)Val; }