summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-09-22 01:24:18 +0000
committerJordan Rose <jordan_rose@apple.com>2012-09-22 01:24:18 +0000
commitf8b0a5e9e348c0afe8e1e49d6c5c8c90935ca766 (patch)
treea3bbd36cd27c319b08f9df93c31a120ffb658cd8 /llvm
parent08f3b9167fc1ed887bd4b97b98f1d1cf6e98d7ac (diff)
downloadbcm5719-llvm-f8b0a5e9e348c0afe8e1e49d6c5c8c90935ca766.tar.gz
bcm5719-llvm-f8b0a5e9e348c0afe8e1e49d6c5c8c90935ca766.zip
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. llvm-svn: 164439
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Support/Casting.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h
index 3aab4367f5b..d35febbe6d8 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -65,18 +65,21 @@ template <typename To, typename From> struct isa_impl_cl<To, const From> {
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);
}
};
OpenPOWER on IntegriCloud