diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-08-28 20:52:21 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-08-28 20:52:21 +0000 |
commit | 8d48938bf38988fd4271cb3064b3f2ab80dd401e (patch) | |
tree | 49b08a5c542bf7edb720178238ab8b9875436b15 /clang/test/Analysis/inline.cpp | |
parent | 2be6e30d960c26532828760bfb07eea5023074a2 (diff) | |
download | bcm5719-llvm-8d48938bf38988fd4271cb3064b3f2ab80dd401e.tar.gz bcm5719-llvm-8d48938bf38988fd4271cb3064b3f2ab80dd401e.zip |
[analyzer] Teach CallEventManager that CXXTemporaryObjectExpr is also a ctor.
Specifically, CallEventManager::getCaller was looking at the call site for
an inlined call and trying to see what kind of call it was, but it only
checked for CXXConstructExprClass. (It's not using an isa<> here to avoid
doing three more checks on the the statement class.)
This caused an unreachable when we actually did inline the constructor of a
temporary object.
PR13717
llvm-svn: 162792
Diffstat (limited to 'clang/test/Analysis/inline.cpp')
-rw-r--r-- | clang/test/Analysis/inline.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/Analysis/inline.cpp b/clang/test/Analysis/inline.cpp index 573b1647a33..26b1035c062 100644 --- a/clang/test/Analysis/inline.cpp +++ b/clang/test/Analysis/inline.cpp @@ -267,3 +267,20 @@ namespace OperatorNew { clang_analyzer_eval(obj->value == 42); // expected-warning{{UNKNOWN}} } } + +namespace TemporaryConstructor { + class BoolWrapper { + public: + BoolWrapper() { + clang_analyzer_checkInlined(true); // expected-warning{{TRUE}} + value = true; + } + bool value; + }; + + void test() { + // PR13717 - Don't crash when a CXXTemporaryObjectExpr is inlined. + if (BoolWrapper().value) + return; + } +} |