summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-09-07 19:48:09 +0000
committerJordan Rose <jordan_rose@apple.com>2012-09-07 19:48:09 +0000
commit8dc77398a1df51cff9f3fa219cf670dd128a5c4d (patch)
tree8fcd382007301642cdefbeb55901c381db555f14 /clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
parent9c93a4a3e0d064c8507e6cb8bb668c358a0ad9ff (diff)
downloadbcm5719-llvm-8dc77398a1df51cff9f3fa219cf670dd128a5c4d.tar.gz
bcm5719-llvm-8dc77398a1df51cff9f3fa219cf670dd128a5c4d.zip
[analyzer] Use cast<> instead of getAs<> for a CFGElement known to be a CFGStmt.
When adding the next statement to the CoreEngine's work list, we take care of all the special cases first. We certainly shouldn't be building PostStmts with null statements (the diagnostics machinery assumes such StmtPoints do not exist), and we should find out sooner if we're missing a special case. A refinement of r163402 that should help prevent further issues like PR13760. llvm-svn: 163409
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CoreEngine.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/CoreEngine.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
index 84d2cc65459..e7b406604fd 100644
--- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -514,10 +514,9 @@ void CoreEngine::enqueueStmtNode(ExplodedNode *N,
return;
}
- CFGElement Elem = (*Block)[Idx];
- const CFGStmt *CS = Elem.getAs<CFGStmt>();
- const Stmt *St = CS ? CS->getStmt() : 0;
- PostStmt Loc(St, N->getLocationContext());
+ // At this point, we know we're processing a normal statement.
+ CFGStmt CS = cast<CFGStmt>((*Block)[Idx]);
+ PostStmt Loc(CS.getStmt(), N->getLocationContext());
if (Loc == N->getLocation()) {
// Note: 'N' should be a fresh node because otherwise it shouldn't be
OpenPOWER on IntegriCloud