From: Jordan Rose Date: Sat, 22 Sep 2012 01:24:18 +0000 (+0000) Subject: Casting: assert that pointer arguments to isa<> are non-null. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f5091b476c46333ecfcf095cd2e422e9748e9546;p=oota-llvm.git Casting: assert that pointer arguments to isa<> are non-null. This silences several analyzer warnings within LLVM, and provides a slightly nicer crash experience when someone calls isa<>, cast<>, or dyn_cast<> with a null pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164439 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/Casting.h b/include/llvm/Support/Casting.h index 3aab4367f5b..d35febbe6d8 100644 --- a/include/llvm/Support/Casting.h +++ b/include/llvm/Support/Casting.h @@ -65,18 +65,21 @@ template struct isa_impl_cl { template struct isa_impl_cl { static inline bool doit(const From *Val) { + assert(Val && "isa<> used on a null pointer"); return isa_impl::doit(*Val); } }; template struct isa_impl_cl { static inline bool doit(const From *Val) { + assert(Val && "isa<> used on a null pointer"); return isa_impl::doit(*Val); } }; template struct isa_impl_cl { static inline bool doit(const From *Val) { + assert(Val && "isa<> used on a null pointer"); return isa_impl::doit(*Val); } };