[llvm-branch-commits] [cfe-branch] r71865 - /cfe/branches/Apple/Dib/lib/Analysis/GRExprEngineInternalChecks.cpp
Mike Stump
mrs at apple.com
Fri May 15 09:18:48 PDT 2009
Author: mrs
Date: Fri May 15 11:18:36 2009
New Revision: 71865
URL: http://llvm.org/viewvc/llvm-project?rev=71865&view=rev
Log:
Merge in 71843:
Use dyn_cast instead of cast to allow our assumptions to be safely wrong.
Modified:
cfe/branches/Apple/Dib/lib/Analysis/GRExprEngineInternalChecks.cpp
Modified: cfe/branches/Apple/Dib/lib/Analysis/GRExprEngineInternalChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/GRExprEngineInternalChecks.cpp?rev=71865&r1=71864&r2=71865&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/GRExprEngineInternalChecks.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/GRExprEngineInternalChecks.cpp Fri May 15 11:18:36 2009
@@ -631,22 +631,30 @@
static const Stmt *GetReceiverExpr(const ExplodedNode<GRState> *N) {
const Stmt *S = N->getLocationAs<PostStmt>()->getStmt();
- return cast<ObjCMessageExpr>(S)->getReceiver();
+ if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S))
+ return ME->getReceiver();
+ return NULL;
}
static const Stmt *GetDenomExpr(const ExplodedNode<GRState> *N) {
const Stmt *S = N->getLocationAs<PostStmt>()->getStmt();
- return cast<BinaryOperator>(S)->getRHS();
+ if (const BinaryOperator *BE = dyn_cast<BinaryOperator>(S))
+ return BE->getRHS();
+ return NULL;
}
static const Stmt *GetCalleeExpr(const ExplodedNode<GRState> *N) {
const Stmt *S = N->getLocationAs<PostStmt>()->getStmt();
- return cast<CallExpr>(S)->getCallee();
+ if (const CallExpr *CE = dyn_cast<CallExpr>(S))
+ return CE->getCallee();
+ return NULL;
}
static const Stmt *GetRetValExpr(const ExplodedNode<GRState> *N) {
const Stmt *S = N->getLocationAs<PostStmt>()->getStmt();
- return cast<ReturnStmt>(S)->getRetValue();
+ if (const ReturnStmt *RS = dyn_cast<ReturnStmt>(S))
+ return RS->getRetValue();
+ return NULL;
}
namespace {
More information about the llvm-branch-commits
mailing list