When retrieving the location of a Node, for MemberExprs use the location of the
'.' or '->'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65651 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 50ef307..a8cb6a9 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -151,6 +151,7 @@
   
   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 @@
 
 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();
 }