Rewrite Expr::isNullPointerConstant() to deal with multiple levels of explicit casts.

Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0"



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45951 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c
index 87fe2d2..24e7115 100644
--- a/test/Sema/conditional-expr.c
+++ b/test/Sema/conditional-expr.c
@@ -1,17 +1,21 @@
 // RUN: clang -fsyntax-only -verify -pedantic %s
 void foo() {
   *(0 ? (double *)0 : (void *)0) = 0;
-  *((void *) 0) = 0; // -expected-error {{incomplete type 'void' is not assignable}}
+  *(0 ? (double *)0 : (void *)(int *)0) = 0;
+  *(0 ? (double *)0 : (void *)(double *)0) = 0;
+  *(0 ? (double *)0 : (int *)(void *)0) = 0; // expected-warning {{pointer type mismatch ('double *' and 'int *')}}
+  *(0 ? (double *)0 : (double *)(void *)0) = 0;
+  *((void *) 0) = 0; // expected-error {{incomplete type 'void' is not assignable}}
   double *dp;
   int *ip;
   void *vp;
 
   dp = vp;
   vp = dp;
-  ip = dp; // -expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
-  dp = ip; // -expected-warning {{incompatible pointer types assigning 'int *', expected 'double *'}}
+  ip = dp; // expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
+  dp = ip; // expected-warning {{incompatible pointer types assigning 'int *', expected 'double *'}}
   dp = 0 ? (double *)0 : (void *)0;
   vp = 0 ? (double *)0 : (void *)0;
-  ip = 0 ? (double *)0 : (void *)0; // -expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
+  ip = 0 ? (double *)0 : (void *)0; // expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
 }