aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-07 05:07:44 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-07 05:07:44 +0000
commita5770b9c0d5b61114bf2f03a82fddca9d31618da (patch)
tree8ca4b1cbd82a5eb9d78698c7d96ac52755ab3b1e /lib/Analysis/CFRefCount.cpp
parent0fa96548f2c729a211b83e85f05400297bb16ec5 (diff)
Remove GetLeakNode. This isn't the right approach.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68502 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp58
1 files changed, 1 insertions, 57 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index cb147977e6..376ccc0887 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -3004,59 +3004,6 @@ CFRefLeakReport::CFRefLeakReport(CFRefBug& D, const CFRefCount &tf,
// Handle dead symbols and end-of-path.
//===----------------------------------------------------------------------===//
-static ExplodedNode<GRState>*
-GetLeakNode(ExplodedNode<GRState>* EndN, SymbolRef Sym,
- GRStateManager &StateMgr) {
-
- // Get the leak site. We want to find the last place where the symbol
- // was used in an expression.
- ExplodedNode<GRState>* LeakN = EndN;
- Stmt *S = 0;
-
- while (LeakN) {
- ProgramPoint P = LeakN->getLocation();
-
- if (const PostStmt *PS = dyn_cast<PostStmt>(&P))
- S = PS->getStmt();
- 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.
- S = BE->getSrc()->getTerminator();
- }
-
- if (S) {
- // Scan 'S' for uses of Sym.
- GRStateRef state(LeakN->getState(), StateMgr);
- bool foundSymbol = false;
-
- // First check if 'S' itself binds to the symbol.
- if (Expr *Ex = dyn_cast<Expr>(S))
- if (state.GetSValAsScalarOrLoc(Ex).getAsLocSymbol() == Sym)
- foundSymbol = true;
-
- if (!foundSymbol)
- for (Stmt::child_iterator I=S->child_begin(), E=S->child_end();
- I!=E; ++I)
- if (Expr *Ex = dyn_cast_or_null<Expr>(*I)) {
- SVal X = state.GetSValAsScalarOrLoc(Ex);
- if (X.getAsLocSymbol() == Sym) {
- foundSymbol = true;
- break;
- }
- }
-
- if (foundSymbol)
- break;
- }
-
- LeakN = LeakN->pred_empty() ? 0 : *(LeakN->pred_begin());
- }
-
- assert(LeakN && "No leak site found.");
- return LeakN;
-}
-
void CFRefCount::EvalEndPath(GRExprEngine& Eng,
GREndPathNodeBuilder<GRState>& Builder) {
@@ -3091,10 +3038,7 @@ void CFRefCount::EvalEndPath(GRExprEngine& Eng,
CFRefBug *BT = static_cast<CFRefBug*>(I->second ? leakAtReturn
: leakWithinFunction);
assert(BT && "BugType not initialized.");
- CFRefLeakReport* report =
- new CFRefLeakReport(*BT, *this,
- GetLeakNode(N, I->first, Eng.getStateManager()),
- I->first, Eng);
+ CFRefLeakReport* report = new CFRefLeakReport(*BT, *this, N, I->first, Eng);
BR->EmitReport(report);
}
}