diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-01 06:13:56 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-01 06:13:56 +0000 |
commit | 5fb5dfb6646464db3cd6d54a6332375c8fe36b75 (patch) | |
tree | 0c5fc288044b8320b5337de39cb1d2dddc7c0bde /lib/Analysis/CFRefCount.cpp | |
parent | 360431660b2245a109f5c6870729126dbcdea254 (diff) |
- Changed PathDiagnosticPiece::getLocation() to return a PathDiagnosticLocation
instead of a FullSourceLoc. This resulted in a bunch of small edits in various
clients.
- Updated BugReporter to include an alternate PathDiagnostic generation
algorithm for PathDiagnosticClients desiring more control-flow pieces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 6e43ec5faf..c9917da82e 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -2635,13 +2635,8 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N, os << "+0 retain count (non-owning reference)."; } - FullSourceLoc Pos(S->getLocStart(), BR.getContext().getSourceManager()); - PathDiagnosticPiece* P = new PathDiagnosticEventPiece(Pos, os.str()); - - if (Expr* Exp = dyn_cast<Expr>(S)) - P->addRange(Exp->getSourceRange()); - - return P; + PathDiagnosticLocation Pos(S, BR.getContext().getSourceManager()); + return new PathDiagnosticEventPiece(Pos, os.str()); } // Gather up the effects that were performed on the object at this @@ -2797,7 +2792,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N, return 0; // We have nothing to say! Stmt* S = cast<PostStmt>(N->getLocation()).getStmt(); - FullSourceLoc Pos(S->getLocStart(), BR.getContext().getSourceManager()); + PathDiagnosticLocation Pos(S, BR.getContext().getSourceManager()); PathDiagnosticPiece* P = new PathDiagnosticEventPiece(Pos, os.str()); // Add the range by scanning the children of the statement for any bindings @@ -2958,7 +2953,9 @@ CFRefLeakReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN){ assert(LeakN && S && "No leak site found."); // Generate the diagnostic. - FullSourceLoc L(S->getLocStart(), SMgr); + // FIXME: We need to do a better job at determing the leak site, e.g., at + // the end of function bodies. + PathDiagnosticLocation L(S, SMgr); std::string sbuf; llvm::raw_string_ostream os(sbuf); |