diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-02-07 22:04:05 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-02-07 22:04:05 +0000 |
commit | 14036554d2dc96635e5318f47be7d9fba8a4cbf2 (patch) | |
tree | 78c54571e53029d138650419e0f17088975dca8b /clang/lib/Analysis/CFRefCount.cpp | |
parent | da545836f096e15279c917e54cf142f778979837 (diff) | |
download | bcm5719-llvm-14036554d2dc96635e5318f47be7d9fba8a4cbf2.tar.gz bcm5719-llvm-14036554d2dc96635e5318f47be7d9fba8a4cbf2.zip |
Split logic for 'getEndPath()' for CFRefReport and CFRefLeakReport.
llvm-svn: 64034
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | clang/lib/Analysis/CFRefCount.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index a5309057606..97bf4fc5183 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/lib/Analysis/CFRefCount.cpp @@ -2091,6 +2091,7 @@ namespace { //===---------===// class VISIBILITY_HIDDEN CFRefReport : public RangedBugReport { + protected: SymbolRef Sym; public: CFRefReport(CFRefBug& D, ExplodedNode<GRState> *n, SymbolRef sym) @@ -2132,7 +2133,10 @@ namespace { public: CFRefLeakReport(CFRefBug& D, ExplodedNode<GRState> *n, SymbolRef sym) : CFRefReport(D, n, sym) {} - + + PathDiagnosticPiece* getEndPath(BugReporter& BR, + const ExplodedNode<GRState>* N); + SourceLocation getLocation() const; }; } // end anonymous namespace @@ -2415,16 +2419,22 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN) { GRBugReporter& BR = cast<GRBugReporter>(br); - // Tell the BugReporter to report cases when the tracked symbol is // assigned to different variables, etc. cast<GRBugReporter>(BR).addNotableSymbol(Sym); - - if (!getBugType().isLeak()) - return RangedBugReport::getEndPath(BR, EndN); - - // We are a leak. Walk up the graph to get to the first node where the - // symbol appeared, and also get the first VarDecl that tracked object + return RangedBugReport::getEndPath(BR, EndN); +} + +PathDiagnosticPiece* +CFRefLeakReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN){ + + GRBugReporter& BR = cast<GRBugReporter>(br); + // Tell the BugReporter to report cases when the tracked symbol is + // assigned to different variables, etc. + cast<GRBugReporter>(BR).addNotableSymbol(Sym); + + // We are reporting a leak. Walk up the graph to get to the first node where + // the symbol appeared, and also get the first VarDecl that tracked object // is stored to. const ExplodedNode<GRState>* AllocNode = 0; const MemRegion* FirstBinding = 0; |