diff options
-rw-r--r-- | lib/StaticAnalyzer/Core/ObjCMessage.cpp | 2 | ||||
-rw-r--r-- | test/Analysis/malloc.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/ObjCMessage.cpp b/lib/StaticAnalyzer/Core/ObjCMessage.cpp index 0c6d8a8b63..994e6fbe62 100644 --- a/lib/StaticAnalyzer/Core/ObjCMessage.cpp +++ b/lib/StaticAnalyzer/Core/ObjCMessage.cpp @@ -139,7 +139,7 @@ bool CallOrObjCMessage::hasNonZeroCallbackArg() const { 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 a7d5b0b0e9..3257d3d95a 100644 --- a/test/Analysis/malloc.c +++ b/test/Analysis/malloc.c @@ -829,6 +829,12 @@ void r11160612_6(StWithCallback St) { 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. |