[analyzer] Use the expression’s type instead of region’s type in ArrayToPointer decay evaluation
This gives slightly better precision, specifically, in cases where a non-typed region represents the array
or when the type is a non-array type, which can happen when an array is a result of a reinterpret_cast.
llvm-svn: 182810
diff --git a/clang/test/Analysis/reference.cpp b/clang/test/Analysis/reference.cpp
index 1dabe7b..bd5eaaa 100644
--- a/clang/test/Analysis/reference.cpp
+++ b/clang/test/Analysis/reference.cpp
@@ -75,6 +75,13 @@
int (&x)[1];
int *m() { return x; }
+
+ void testArrayToPointerDecayWithNonTypedValueRegion() {
+ int *p = x;
+ int *q = x;
+ clang_analyzer_eval(p[0] == q[0]); // expected-warning{{TRUE}}
+ }
+
};
void test() {