aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BugReporter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r--lib/Analysis/BugReporter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 50ef3070ab..a8cb6a9107 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/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();
}