diff options
author | Anna Zaks <ganna@apple.com> | 2013-05-28 22:32:08 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-05-28 22:32:08 +0000 |
commit | 6477e97af73a6bc036888d68b79d919f8b11cd2a (patch) | |
tree | 2f658478a5f9f5d40d0476f0ecba36d6020251a1 /clang/test | |
parent | 0259300325d0816219e3816659b1831375950538 (diff) | |
download | bcm5719-llvm-6477e97af73a6bc036888d68b79d919f8b11cd2a.tar.gz bcm5719-llvm-6477e97af73a6bc036888d68b79d919f8b11cd2a.zip |
[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
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Analysis/reinterpret-cast.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/Analysis/reinterpret-cast.cpp b/clang/test/Analysis/reinterpret-cast.cpp index 59e6a539a11..cb7cbfd325d 100644 --- a/clang/test/Analysis/reinterpret-cast.cpp +++ b/clang/test/Analysis/reinterpret-cast.cpp @@ -86,3 +86,20 @@ namespace PR15345 { 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 |