From: Anna Zaks Date: Fri, 18 May 2012 22:47:43 +0000 (+0000) Subject: [analyzer] Fix a c++11 crash: xvalues can be locations (VisitMemberExpr) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=719b429e3ed660cfd9cce88397b29c695a25fa50;p=clang [analyzer] Fix a c++11 crash: xvalues can be locations (VisitMemberExpr) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157082 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index 97a8cefd13..dcc79a543f 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1537,7 +1537,7 @@ void ExprEngine::VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred, // For all other cases, compute an lvalue. SVal L = state->getLValue(field, baseExprVal); - if (M->isLValue()) + if (M->isGLValue()) Bldr.generateNode(M, Pred, state->BindExpr(M, LCtx, L), false, 0, ProgramPoint::PostLValueKind); else { diff --git a/test/Analysis/cxx11-crashes.cpp b/test/Analysis/cxx11-crashes.cpp new file mode 100644 index 0000000000..9164850555 --- /dev/null +++ b/test/Analysis/cxx11-crashes.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -std=c++11 -verify %s + +// radar://11485149, PR12871 +class PlotPoint { + bool valid; +}; + +PlotPoint limitedFit () { + PlotPoint fit0; + fit0 = limitedFit (); + return fit0; +}