Added boilerplate transfer function support for CallExprs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47298 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/ValueState.cpp b/Analysis/ValueState.cpp
index 32be0c6..0f29def 100644
--- a/Analysis/ValueState.cpp
+++ b/Analysis/ValueState.cpp
@@ -220,6 +220,8 @@
           // a better way, since APInts are fairly lightweight.
           return nonlval::ConcreteInt(ValMgr.getValue(ED->getInitVal()));
         }
+        else if (FunctionDecl* FD = dyn_cast<FunctionDecl>(D))
+          return lval::FuncVal(FD);
         
         assert (false &&
                 "ValueDecl support for this ValueDecl not implemented.");
@@ -248,7 +250,10 @@
         
       case Stmt::ImplicitCastExprClass: {
         ImplicitCastExpr* C = cast<ImplicitCastExpr>(E);
-        if (C->getType() == C->getSubExpr()->getType()) {
+        QualType CT = C->getType();
+        QualType ST = C->getSubExpr()->getType();
+        
+        if (CT == ST || (CT->isPointerType() && ST->isFunctionType())) {
           E = C->getSubExpr();
           continue;
         }
@@ -257,7 +262,10 @@
         
       case Stmt::CastExprClass: {
         CastExpr* C = cast<CastExpr>(E);
-        if (C->getType() == C->getSubExpr()->getType()) {
+        QualType CT = C->getType();
+        QualType ST = C->getSubExpr()->getType();
+        
+        if (CT == ST || (CT->isPointerType() && ST->isFunctionType())) {
           E = C->getSubExpr();
           continue;
         }
@@ -297,8 +305,14 @@
   while (ParenExpr* P = dyn_cast<ParenExpr>(E))
     E = P->getSubExpr();
   
-  if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E))
-    return lval::DeclVal(cast<VarDecl>(DR->getDecl()));
+  if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E)) {
+    ValueDecl* VD = DR->getDecl();
+    
+    if (FunctionDecl* FD = dyn_cast<FunctionDecl>(VD))
+      return lval::FuncVal(FD);
+    else
+      return lval::DeclVal(cast<VarDecl>(DR->getDecl()));
+  }
   
   if (UnaryOperator* U = dyn_cast<UnaryOperator>(E))
     if (U->getOpcode() == UnaryOperator::Deref)