aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/ExprEngine.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-02-21 22:23:56 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-02-21 22:23:56 +0000
commit7a95de68c093991047ed8d339479ccad51b88663 (patch)
tree30fb6ba3d10757a7453dab5e854dc12db3cd1168 /lib/StaticAnalyzer/Core/ExprEngine.cpp
parent94f3f549a7e0c426d5ffda7f25d1983c885dab9c (diff)
Replace ProgramPoint llvm::cast support to be well-defined.
See r175462 for another example/more details. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngine.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 3e5fd06bea..06b1db564d 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -250,7 +250,7 @@ static bool shouldRemoveDeadBindings(AnalysisManager &AMgr,
return false;
// Is this the beginning of a basic block?
- if (isa<BlockEntrance>(Pred->getLocation()))
+ if (Pred->getLocation().getAs<BlockEntrance>())
return true;
// Is this on a non-expression?
@@ -1056,11 +1056,11 @@ bool ExprEngine::replayWithoutInlining(ExplodedNode *N,
// processing the call.
if (L.isPurgeKind())
continue;
- if (isa<PreImplicitCall>(&L))
+ if (L.getAs<PreImplicitCall>())
continue;
- if (isa<CallEnter>(&L))
+ if (L.getAs<CallEnter>())
continue;
- if (const StmtPoint *SP = dyn_cast<StmtPoint>(&L))
+ if (Optional<StmtPoint> SP = L.getAs<StmtPoint>())
if (SP->getStmt() == CE)
continue;
break;
@@ -1953,7 +1953,7 @@ void ExprEngine::evalEagerlyAssumeBinOpBifurcation(ExplodedNodeSet &Dst,
// when the expression fails to evaluate to anything meaningful and
// (as an optimization) we don't generate a node.
ProgramPoint P = Pred->getLocation();
- if (!isa<PostStmt>(P) || cast<PostStmt>(P).getStmt() != Ex) {
+ if (!P.getAs<PostStmt>() || P.castAs<PostStmt>().getStmt() != Ex) {
continue;
}
@@ -2073,7 +2073,7 @@ struct DOTGraphTraits<ExplodedNode*> :
switch (Loc.getKind()) {
case ProgramPoint::BlockEntranceKind: {
Out << "Block Entrance: B"
- << cast<BlockEntrance>(Loc).getBlock()->getBlockID();
+ << Loc.castAs<BlockEntrance>().getBlock()->getBlockID();
if (const NamedDecl *ND =
dyn_cast<NamedDecl>(Loc.getLocationContext()->getDecl())) {
Out << " (";
@@ -2112,27 +2112,27 @@ struct DOTGraphTraits<ExplodedNode*> :
break;
case ProgramPoint::PreImplicitCallKind: {
- ImplicitCallPoint *PC = cast<ImplicitCallPoint>(&Loc);
+ ImplicitCallPoint PC = Loc.castAs<ImplicitCallPoint>();
Out << "PreCall: ";
// FIXME: Get proper printing options.
- PC->getDecl()->print(Out, LangOptions());
- printLocation(Out, PC->getLocation());
+ PC.getDecl()->print(Out, LangOptions());
+ printLocation(Out, PC.getLocation());
break;
}
case ProgramPoint::PostImplicitCallKind: {
- ImplicitCallPoint *PC = cast<ImplicitCallPoint>(&Loc);
+ ImplicitCallPoint PC = Loc.castAs<ImplicitCallPoint>();
Out << "PostCall: ";
// FIXME: Get proper printing options.
- PC->getDecl()->print(Out, LangOptions());
- printLocation(Out, PC->getLocation());
+ PC.getDecl()->print(Out, LangOptions());
+ printLocation(Out, PC.getLocation());
break;
}
default: {
- if (StmtPoint *L = dyn_cast<StmtPoint>(&Loc)) {
+ if (Optional<StmtPoint> L = Loc.getAs<StmtPoint>()) {
const Stmt *S = L->getStmt();
Out << S->getStmtClassName() << ' ' << (const void*) S << ' ';
@@ -2140,13 +2140,13 @@ struct DOTGraphTraits<ExplodedNode*> :
S->printPretty(Out, 0, PrintingPolicy(LO));
printLocation(Out, S->getLocStart());
- if (isa<PreStmt>(Loc))
+ if (Loc.getAs<PreStmt>())
Out << "\\lPreStmt\\l;";
- else if (isa<PostLoad>(Loc))
+ else if (Loc.getAs<PostLoad>())
Out << "\\lPostLoad\\l;";
- else if (isa<PostStore>(Loc))
+ else if (Loc.getAs<PostStore>())
Out << "\\lPostStore\\l";
- else if (isa<PostLValue>(Loc))
+ else if (Loc.getAs<PostLValue>())
Out << "\\lPostLValue\\l";
#if 0
@@ -2173,7 +2173,7 @@ struct DOTGraphTraits<ExplodedNode*> :
break;
}
- const BlockEdge &E = cast<BlockEdge>(Loc);
+ const BlockEdge &E = Loc.castAs<BlockEdge>();
Out << "Edge: (B" << E.getSrc()->getBlockID() << ", B"
<< E.getDst()->getBlockID() << ')';