aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-02-24 23:30:57 +0000
committerTed Kremenek <kremenek@apple.com>2009-02-24 23:30:57 +0000
commit4094b34a6058e351eeefdfb0639061513f1b4c0a (patch)
tree491b94cbd90670f58971ed7f58d506f85daa09ba /lib/Analysis/CFRefCount.cpp
parent7782022c0c9c4721b097953f49378aa34358cea1 (diff)
Fix diagnostic regression where the leak diagnostic could appear earlier in the path than the branches taken.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 3a88877ba5..faf7839418 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -2698,12 +2698,18 @@ CFRefLeakReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN){
Stmt *S = 0;
while (LeakN) {
+ bool atBranch = false;
ProgramPoint P = LeakN->getLocation();
if (const PostStmt *PS = dyn_cast<PostStmt>(&P))
S = PS->getStmt();
- else if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P))
+ else if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
+ // FIXME: What we really want is to set LeakN to be the node
+ // for the BlockEntrance for the branch we took and have BugReporter
+ // do the right thing.
+ atBranch = true;
S = BE->getSrc()->getTerminator();
+ }
if (S) {
// Scan 'S' for uses of Sym.
@@ -2734,6 +2740,10 @@ CFRefLeakReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN){
break;
}
+ // Don't traverse any higher than the branch.
+ if (atBranch)
+ break;
+
LeakN = LeakN->pred_empty() ? 0 : *(LeakN->pred_begin());
}