Placed transfer function logic for dereferences in its own method, while at
the same time clearing up some logic of how the unary '*' operator is processed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47356 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/ValueState.cpp b/Analysis/ValueState.cpp
index 5796238..d756980 100644
--- a/Analysis/ValueState.cpp
+++ b/Analysis/ValueState.cpp
@@ -310,9 +310,8 @@
 
 LValue ValueStateManager::GetLValue(ValueState St, Expr* E) {
   
-  while (ParenExpr* P = dyn_cast<ParenExpr>(E))
-    E = P->getSubExpr();
-  
+  E = E->IgnoreParens();
+
   if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E)) {
     ValueDecl* VD = DR->getDecl();
     
@@ -323,9 +322,17 @@
   }
   
   if (UnaryOperator* U = dyn_cast<UnaryOperator>(E))
-    if (U->getOpcode() == UnaryOperator::Deref)
-      return cast<LValue>(GetValue(St, U->getSubExpr()));
-  
+    if (U->getOpcode() == UnaryOperator::Deref) {
+      E = U->getSubExpr()->IgnoreParens();
+        
+      if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E)) {
+        lval::DeclVal X(cast<VarDecl>(DR->getDecl()));
+        return cast<LValue>(GetValue(St, X));
+      }
+      else
+        return cast<LValue>(GetValue(St, E));
+    }
+        
   return cast<LValue>(GetValue(St, E));
 }