[analyzer]Fixup r156134: Handle the case when FunctionDecl isn't avail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156183 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Core/ObjCMessage.cpp b/lib/StaticAnalyzer/Core/ObjCMessage.cpp
index 0c6d8a8..994e6fb 100644
--- a/lib/StaticAnalyzer/Core/ObjCMessage.cpp
+++ b/lib/StaticAnalyzer/Core/ObjCMessage.cpp
@@ -139,7 +139,7 @@
     FD = Ctor->getConstructor();
 
   const CallExpr * CE = CallE.get<const CallExpr *>();
-  FD = dyn_cast<FunctionDecl>(CE->getCalleeDecl());
+  FD = dyn_cast_or_null<FunctionDecl>(CE->getCalleeDecl());
 
   // If calling using a function pointer, assume the function does not
   // have a callback. TODO: We could check the types of the arguments here.
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c
index a7d5b0b..3257d3d 100644
--- a/test/Analysis/malloc.c
+++ b/test/Analysis/malloc.c
@@ -829,6 +829,12 @@
   dealocateMemWhenDoneByRef(&St, x);
 }
 
+int mySub(int, int);
+int myAdd(int, int);
+int fPtr(unsigned cond, int x) {
+  return (cond ? mySub : myAdd)(x, x);
+}
+
 // ----------------------------------------------------------------------------
 // Below are the known false positives.