[analyzer] check for now possibly null predecessor edge.

llvm-svn: 202434
This commit is contained in:
Ted Kremenek 2014-02-27 21:56:41 +00:00
parent b1531e582f
commit 4b408e7a04

View File

@ -178,6 +178,9 @@ void UnreachableCodeChecker::FindUnreachableEntryPoints(const CFGBlock *CB,
for (CFGBlock::const_pred_iterator I = CB->pred_begin(), E = CB->pred_end();
I != E; ++I) {
if (!*I)
continue;
if (!reachable.count((*I)->getBlockID())) {
// If we find an unreachable predecessor, mark this block as reachable so
// we don't report this block
@ -219,6 +222,8 @@ bool UnreachableCodeChecker::isInvalidPath(const CFGBlock *CB,
return false;
const CFGBlock *pred = *CB->pred_begin();
if (!pred)
return false;
// Get the predecessor block's terminator conditon
const Stmt *cond = pred->getTerminatorCondition();