]> granicus.if.org Git - clang/commitdiff
[analyzer] Fix a c++11 crash: xvalues can be locations (VisitMemberExpr)
authorAnna Zaks <ganna@apple.com>
Fri, 18 May 2012 22:47:43 +0000 (22:47 +0000)
committerAnna Zaks <ganna@apple.com>
Fri, 18 May 2012 22:47:43 +0000 (22:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157082 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/ExprEngine.cpp
test/Analysis/cxx11-crashes.cpp [new file with mode: 0644]

index 97a8cefd13a7ddb38f8631c05e2c53c6a066dcd3..dcc79a543f3a3c11254d9cfc027f1f1a64d161a6 100644 (file)
@@ -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 (file)
index 0000000..9164850
--- /dev/null
@@ -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;
+}