[llvm-branch-commits] [llvm-branch] r164515 - /llvm/branches/R600/include/llvm/Support/Casting.h
Tom Stellard
thomas.stellard at amd.com
Mon Sep 24 08:53:44 PDT 2012
Author: tstellar
Date: Mon Sep 24 10:52:06 2012
New Revision: 164515
URL: http://llvm.org/viewvc/llvm-project?rev=164515&view=rev
Log:
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.
Modified:
llvm/branches/R600/include/llvm/Support/Casting.h
Modified: llvm/branches/R600/include/llvm/Support/Casting.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Support/Casting.h?rev=164515&r1=164514&r2=164515&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Support/Casting.h (original)
+++ llvm/branches/R600/include/llvm/Support/Casting.h Mon Sep 24 10:52:06 2012
@@ -65,18 +65,21 @@
template <typename To, typename From> struct isa_impl_cl<To, From*> {
static inline bool doit(const From *Val) {
+ assert(Val && "isa<> used on a null pointer");
return isa_impl<To, From>::doit(*Val);
}
};
template <typename To, typename From> struct isa_impl_cl<To, const From*> {
static inline bool doit(const From *Val) {
+ assert(Val && "isa<> used on a null pointer");
return isa_impl<To, From>::doit(*Val);
}
};
template <typename To, typename From> struct isa_impl_cl<To, const From*const> {
static inline bool doit(const From *Val) {
+ assert(Val && "isa<> used on a null pointer");
return isa_impl<To, From>::doit(*Val);
}
};
More information about the llvm-branch-commits
mailing list