[cfe-commits] r156183 - in /cfe/trunk: lib/StaticAnalyzer/Core/ObjCMessage.cpp test/Analysis/malloc.c
Anna Zaks
ganna at apple.com
Fri May 4 10:37:16 PDT 2012
Author: zaks
Date: Fri May 4 12:37:16 2012
New Revision: 156183
URL: http://llvm.org/viewvc/llvm-project?rev=156183&view=rev
Log:
[analyzer]Fixup r156134: Handle the case when FunctionDecl isn't avail.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp
cfe/trunk/test/Analysis/malloc.c
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp?rev=156183&r1=156182&r2=156183&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp Fri May 4 12:37:16 2012
@@ -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.
Modified: cfe/trunk/test/Analysis/malloc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc.c?rev=156183&r1=156182&r2=156183&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/malloc.c (original)
+++ cfe/trunk/test/Analysis/malloc.c Fri May 4 12:37:16 2012
@@ -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.
More information about the cfe-commits
mailing list