summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-01 06:13:56 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-01 06:13:56 +0000
commit0bb090923349f80d4b461dde91772422087efb61 (patch)
tree31857d56831cb6400d84193b0f63e6fc66036f79 /clang/lib/Analysis/CFRefCount.cpp
parentcd76e673eb40779b526e3bbd60b51202572a1d6c (diff)
downloadbcm5719-llvm-0bb090923349f80d4b461dde91772422087efb61.tar.gz
bcm5719-llvm-0bb090923349f80d4b461dde91772422087efb61.zip
- 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. llvm-svn: 68193
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index 6e43ec5fafb..c9917da82ee 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud