handle CXXFunctionalCastExpr in visitLValue and Environment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120143 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/Environment.cpp b/lib/Checker/Environment.cpp
index b09cb9d..798f9ba 100644
--- a/lib/Checker/Environment.cpp
+++ b/lib/Checker/Environment.cpp
@@ -78,6 +78,10 @@
       case Stmt::CXXBindTemporaryExprClass:
         E = cast<CXXBindTemporaryExpr>(E)->getSubExpr();
         continue;
+
+      case Stmt::CXXFunctionalCastExprClass:
+        E = cast<CXXFunctionalCastExpr>(E)->getSubExpr();
+        continue;
         
       // Handle all other Stmt* using a lookup.
       default:
diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp
index 2181b70..6db8dba 100644
--- a/lib/Checker/GRExprEngine.cpp
+++ b/lib/Checker/GRExprEngine.cpp
@@ -1158,6 +1158,18 @@
       break;
     }
 
+    case Stmt::CXXConstructExprClass: {
+      const CXXConstructExpr *expr = cast<CXXConstructExpr>(Ex);
+      VisitCXXConstructExpr(expr, 0, Pred, Dst, true);
+      break;
+    }
+
+    case Stmt::CXXFunctionalCastExprClass: {
+      const CXXFunctionalCastExpr *expr = cast<CXXFunctionalCastExpr>(Ex);
+      VisitLValue(expr->getSubExpr(), Pred, Dst);
+      break;
+    }
+
     case Stmt::CXXTemporaryObjectExprClass: {
       const CXXTemporaryObjectExpr *expr = cast<CXXTemporaryObjectExpr>(Ex);
       VisitCXXTemporaryObjectExpr(expr, Pred, Dst, true);
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
index 6cfbda8..8c6b9da 100644
--- a/test/Analysis/method-call.cpp
+++ b/test/Analysis/method-call.cpp
@@ -17,3 +17,14 @@
   }
 }
 
+void f2() {
+  const A &x = A(3);
+  if (x.getx() == 3) {
+    int *p = 0;
+    *p = 3;  // expected-warning{{Dereference of null pointer}}
+  } else {
+    int *p = 0;
+    *p = 3;  // no-warning
+  }
+}
+