diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-04-30 03:00:57 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-04-30 03:00:57 +0000 |
commit | eb71c0c961d4e0f9138164eb5c7ab22758385fdc (patch) | |
tree | fbc8a93ae84b98120a9f4a448bd426b863e1be13 /clang/test/Analysis/smart-ptr.cpp | |
parent | baa55074384d8ea27a901d973cef81592fecd23b (diff) | |
download | bcm5719-llvm-eb71c0c961d4e0f9138164eb5c7ab22758385fdc.tar.gz bcm5719-llvm-eb71c0c961d4e0f9138164eb5c7ab22758385fdc.zip |
[analyzer] SmartPtrModeling: Fix a null dereference.
Don't crash when trying to model a call in which the callee is unknown
in compile time, eg. a pointer-to-member call.
Differential Revision: https://reviews.llvm.org/D61285
llvm-svn: 359530
Diffstat (limited to 'clang/test/Analysis/smart-ptr.cpp')
-rw-r--r-- | clang/test/Analysis/smart-ptr.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Analysis/smart-ptr.cpp b/clang/test/Analysis/smart-ptr.cpp index 3f1782480b4..ae6966b4e6f 100644 --- a/clang/test/Analysis/smart-ptr.cpp +++ b/clang/test/Analysis/smart-ptr.cpp @@ -16,3 +16,13 @@ void derefAfterMove(std::unique_ptr<int> P) { // TODO: Report a null dereference (instead). *P.get() = 1; // expected-warning {{Method called on moved-from object 'P'}} } + +// Don't crash when attempting to model a call with unknown callee. +namespace testUnknownCallee { +struct S { + void foo(); +}; +void bar(S *s, void (S::*func)(void)) { + (s->*func)(); // no-crash +} +} // namespace testUnknownCallee |