aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-02-14 17:59:23 +0000
committerTed Kremenek <kremenek@apple.com>2011-02-14 17:59:23 +0000
commite8350c6996170e324b31cd188d002fe5f40f54f7 (patch)
tree90820d5eaa74afdfb86deea94f2661ba6886df5f /lib
parent8e3767711f79578ff2aac8a0d28de1e08a3923f4 (diff)
Fix edge case where we don't cull warnings in IdempotentOperationsChecker due to incomplete analysis of loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125495 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
index 92ce2c313e..0b8ebfd285 100644
--- a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
@@ -578,7 +578,12 @@ IdempotentOperationChecker::pathWasCompletelyAnalyzed(const CFG *cfg,
// The destination block on the BlockEdge is the first block that was not
// analyzed. If we can reach this block from the aborted block, then this
// block was not completely analyzed.
- if (CRA->isReachable(BE.getDst(), CB))
+ //
+ // Also explicitly check if the current block is the destination block.
+ // While technically reachable, it means we aborted the analysis on
+ // a path that included that block.
+ const CFGBlock *destBlock = BE.getDst();
+ if (destBlock == CB || CRA->isReachable(destBlock, CB))
return false;
}