1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Improve error messages on assertion failure.

llvm-svn: 821
This commit is contained in:
Chris Lattner 2001-10-15 13:13:32 +00:00
parent 9754557583
commit b66d7f5416

View File

@ -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;
}