diff options
author | Devin Coughlin <dcoughlin@apple.com> | 2015-11-09 19:50:29 +0000 |
---|---|---|
committer | Devin Coughlin <dcoughlin@apple.com> | 2015-11-09 19:50:29 +0000 |
commit | 9c76869bc33c25d07d5b4ed3eacf310e3f3537cb (patch) | |
tree | f9e1d4a8dc1e48810c8c5d88ca139925c02a9b24 /clang/test/Analysis/const-method-call.cpp | |
parent | 390191dacc4e3573dcd778b6afbf42db53bc2c15 (diff) | |
download | bcm5719-llvm-9c76869bc33c25d07d5b4ed3eacf310e3f3537cb.tar.gz bcm5719-llvm-9c76869bc33c25d07d5b4ed3eacf310e3f3537cb.zip |
[analyzer] Fix assertion failure invalidating on const member function calls (PR25392).
We now return early when the 'this' value cannot be converted to a MemRegion.
llvm-svn: 252506
Diffstat (limited to 'clang/test/Analysis/const-method-call.cpp')
-rw-r--r-- | clang/test/Analysis/const-method-call.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/Analysis/const-method-call.cpp b/clang/test/Analysis/const-method-call.cpp index 25909f82758..b8aaeea6c3e 100644 --- a/clang/test/Analysis/const-method-call.cpp +++ b/clang/test/Analysis/const-method-call.cpp @@ -204,6 +204,25 @@ void PR21606() s2().f(0); } +// --- PR25392 --- // + +struct HasConstMemberFunction { +public: + void constMemberFunction() const; +}; + +HasConstMemberFunction hasNoReturn() { } // expected-warning {{control reaches end of non-void function}} + +void testUnknownWithConstMemberFunction() { + hasNoReturn().constMemberFunction(); +} + +void testNonRegionLocWithConstMemberFunction() { + (*((HasConstMemberFunction *)(&&label))).constMemberFunction(); + + label: return; +} + // FIXME // When there is a circular reference to an object and a const method is called // the object is not invalidated because TK_PreserveContents has already been |