summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-02-27 20:05:10 +0000
committerTed Kremenek <kremenek@apple.com>2009-02-27 20:05:10 +0000
commitcbcc5e83cafd4486efbbdd82f4bf125a7e07ffa9 (patch)
tree481a7153e66b525df598af1cc3bb0f4c11476d63
parente879e15ed9edb4187a7a50eac05e1f3fc48b5143 (diff)
downloadbcm5719-llvm-cbcc5e83cafd4486efbbdd82f4bf125a7e07ffa9.tar.gz
bcm5719-llvm-cbcc5e83cafd4486efbbdd82f4bf125a7e07ffa9.zip
When retrieving the location of a Node, for MemberExprs use the location of the
'.' or '->'. llvm-svn: 65651
-rw-r--r--clang/lib/Analysis/BugReporter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index 50ef3070ab0..a8cb6a9107a 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -151,6 +151,7 @@ void BugReport::getRanges(BugReporter& BR, const SourceRange*& beg,
if (Expr* E = dyn_cast_or_null<Expr>(getStmt(BR))) {
R = E->getSourceRange();
+ assert(R.isValid());
beg = &R;
end = beg+1;
}
@@ -160,8 +161,13 @@ void BugReport::getRanges(BugReporter& BR, const SourceRange*& beg,
SourceLocation BugReport::getLocation() const {
if (EndNode)
- if (Stmt* S = GetCurrentOrPreviousStmt(EndNode))
+ if (Stmt* S = GetCurrentOrPreviousStmt(EndNode)) {
+ // For member expressions, return the location of the '.' or '->'.
+ if (MemberExpr* ME = dyn_cast<MemberExpr>(S))
+ return ME->getMemberLoc();
+
return S->getLocStart();
+ }
return FullSourceLoc();
}
OpenPOWER on IntegriCloud