From 8d48938bf38988fd4271cb3064b3f2ab80dd401e Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Tue, 28 Aug 2012 20:52:21 +0000 Subject: [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 --- clang/test/Analysis/inline.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'clang/test/Analysis/inline.cpp') 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; + } +} -- cgit v1.2.3