[analyzer] Re-enable reasoning about CK_LValueBitCast
It’s important for us to reason about the cast as it is used in std::addressof. The reason we did not
handle the cast previously was a crash on a test case (see commit r157478). The crash was in
processing array to pointer decay when the region type was not an array. Address the issue, by
just returning an unknown in that case.
llvm-svn: 182808
diff --git a/clang/test/Analysis/reinterpret-cast.cpp b/clang/test/Analysis/reinterpret-cast.cpp
index 59e6a53..cb7cbfd 100644
--- a/clang/test/Analysis/reinterpret-cast.cpp
+++ b/clang/test/Analysis/reinterpret-cast.cpp
@@ -86,3 +86,20 @@
clang_analyzer_eval(p->x == 42); // expected-warning{{TRUE}}
};
}
+
+int trackpointer_std_addressof() {
+ int x;
+ int *p = (int*)&reinterpret_cast<const volatile char&>(x);
+ *p = 6;
+ return x; // no warning
+}
+
+void set_x1(int *&);
+void set_x2(void *&);
+int radar_13146953(void) {
+ int *x = 0, *y = 0;
+
+ set_x1(x);
+ set_x2((void *&)y);
+ return *x + *y; // no warning
+}
\ No newline at end of file