summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-05-04 17:37:16 +0000
committerAnna Zaks <ganna@apple.com>2012-05-04 17:37:16 +0000
commit63509fbaccc2c7cea4e101d3ff6aca6fe9741ba3 (patch)
tree56dd7bdd418dab44e48a7bbd4d1069dec1d52bef /clang
parentdf7aad41fd347e82dbab24fdc7c2fbaa6ca767fb (diff)
downloadbcm5719-llvm-63509fbaccc2c7cea4e101d3ff6aca6fe9741ba3.tar.gz
bcm5719-llvm-63509fbaccc2c7cea4e101d3ff6aca6fe9741ba3.zip
[analyzer]Fixup r156134: Handle the case when FunctionDecl isn't avail.
llvm-svn: 156183
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ObjCMessage.cpp2
-rw-r--r--clang/test/Analysis/malloc.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ObjCMessage.cpp b/clang/lib/StaticAnalyzer/Core/ObjCMessage.cpp
index 0c6d8a8b63d..994e6fbe622 100644
--- a/clang/lib/StaticAnalyzer/Core/ObjCMessage.cpp
+++ b/clang/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/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c
index a7d5b0b0e94..3257d3d95a5 100644
--- a/clang/test/Analysis/malloc.c
+++ b/clang/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.
OpenPOWER on IntegriCloud