diff options
Diffstat (limited to 'clang/lib/Checker/UnreachableCodeChecker.cpp')
-rw-r--r-- | clang/lib/Checker/UnreachableCodeChecker.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Checker/UnreachableCodeChecker.cpp b/clang/lib/Checker/UnreachableCodeChecker.cpp index a84a3a56039..432967e00c2 100644 --- a/clang/lib/Checker/UnreachableCodeChecker.cpp +++ b/clang/lib/Checker/UnreachableCodeChecker.cpp @@ -149,10 +149,13 @@ void UnreachableCodeChecker::FindUnreachableEntryPoints(const CFGBlock *CB) { for (CFGBlock::const_pred_iterator I = CB->pred_begin(); I != CB->pred_end(); ++I) { // Recurse over all unreachable blocks - if (!reachable.count((*I)->getBlockID()) - && !visited.count((*I)->getBlockID())) { - FindUnreachableEntryPoints(*I); + if (!reachable.count((*I)->getBlockID())) { + // At least one predeccessor was unreachable allPredecessorsReachable = false; + + // Only visit the block once + if (!visited.count((*I)->getBlockID())) + FindUnreachableEntryPoints(*I); } } |