diff options
author | Anna Zaks <ganna@apple.com> | 2013-04-25 00:41:32 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-04-25 00:41:32 +0000 |
commit | 99394bbd0290922789b71a765d6c6939d2d8b74e (patch) | |
tree | 17379005f833be9695c95b2b1053968cbc828ab6 /clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | |
parent | 3508389233ebe845eb452d1ea64e6b4e592475c2 (diff) | |
download | bcm5719-llvm-99394bbd0290922789b71a765d6c6939d2d8b74e.tar.gz bcm5719-llvm-99394bbd0290922789b71a765d6c6939d2d8b74e.zip |
[analyzer] Fix a crash in RetainCountChecker - we should not rely on CallEnter::getCallExpr to return non-NULL
We get a CallEnter with a null expression, when processing a destructor. All other users of
CallEnter::getCallExpr work fine with null as return value.
(Addresses PR15832, Thanks to Jordan for reducing the test case!)
llvm-svn: 180234
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 824ce34ab33..0d256006e1c 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2192,7 +2192,7 @@ GetAllocationSite(ProgramStateManager& StateMgr, const ExplodedNode *N, if (!InitMethodContext) if (Optional<CallEnter> CEP = N->getLocation().getAs<CallEnter>()) { const Stmt *CE = CEP->getCallExpr(); - if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(CE)) { + if (const ObjCMessageExpr *ME = dyn_cast_or_null<ObjCMessageExpr>(CE)) { const Stmt *RecExpr = ME->getInstanceReceiver(); if (RecExpr) { SVal RecV = St->getSVal(RecExpr, NContext); |