From: Argyrios Kyrtzidis Date: Sat, 19 Feb 2011 01:08:41 +0000 (+0000) Subject: [analyzer] Fix crash when analyzing C++ code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ff07dce18a7c693fe1a15bd7b790d8de9d21e92;p=clang [analyzer] Fix crash when analyzing C++ code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126007 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/Environment.cpp b/lib/StaticAnalyzer/Core/Environment.cpp index a0a93c68a3..33f1945ce7 100644 --- a/lib/StaticAnalyzer/Core/Environment.cpp +++ b/lib/StaticAnalyzer/Core/Environment.cpp @@ -56,6 +56,7 @@ SVal Environment::getSVal(const Stmt *E, SValBuilder& svalBuilder) const { return svalBuilder.makeIntVal(cast(E)); } case Stmt::ImplicitCastExprClass: + case Stmt::CXXFunctionalCastExprClass: case Stmt::CStyleCastExprClass: { // We blast through no-op casts to get the descendant // subexpression that has a value. @@ -75,9 +76,6 @@ SVal Environment::getSVal(const Stmt *E, SValBuilder& svalBuilder) const { case Stmt::CXXBindTemporaryExprClass: E = cast(E)->getSubExpr(); continue; - case Stmt::CXXFunctionalCastExprClass: - E = cast(E)->getSubExpr(); - continue; // Handle all other Stmt* using a lookup. default: break; diff --git a/test/Analysis/cxx-crashes.cpp b/test/Analysis/cxx-crashes.cpp index db2298df89..c15eea862e 100644 --- a/test/Analysis/cxx-crashes.cpp +++ b/test/Analysis/cxx-crashes.cpp @@ -6,6 +6,10 @@ int f1(char *dst) { return !(q >= p); } +long f2(char *c) { + return long(c) & 1; +} + namespace { struct A { };