r202434 - [analyzer] check for now possibly null predecessor edge.
Ted Kremenek
kremenek at apple.com
Thu Feb 27 13:56:42 PST 2014
Author: kremenek
Date: Thu Feb 27 15:56:41 2014
New Revision: 202434
URL: http://llvm.org/viewvc/llvm-project?rev=202434&view=rev
Log:
[analyzer] check for now possibly null predecessor edge.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp?rev=202434&r1=202433&r2=202434&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp Thu Feb 27 15:56:41 2014
@@ -178,6 +178,9 @@ void UnreachableCodeChecker::FindUnreach
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::isInvalidPa
return false;
const CFGBlock *pred = *CB->pred_begin();
+ if (!pred)
+ return false;
// Get the predecessor block's terminator conditon
const Stmt *cond = pred->getTerminatorCondition();
More information about the cfe-commits
mailing list