Start and end location of a property-dot syntax expression
must match start and end location of the expression
as expected by the rewriter client. Fixes // rdar: // 8520727



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115934 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index f6dc441..9a3cb44 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3289,11 +3289,14 @@
         // Check the use of this method.
         if (DiagnoseUseOfDecl(OMD, MemberLoc))
           return ExprError();
-
+        // It is important that start and end position is the first character
+        // and last character position of the property-dot syntax expression.
+        SourceLocation MemberEndLoc = PP.getLocForEndOfToken(MemberLoc, 1);
         return Owned(ObjCMessageExpr::Create(Context,
                                              OMD->getSendResultType(),
-                                             OpLoc, BaseExpr, Sel,
-                                             OMD, NULL, 0, MemberLoc));
+                                             BaseExpr->getExprLoc(), 
+                                             BaseExpr, Sel,
+                                             OMD, NULL, 0, MemberEndLoc));
       }
     }
 
diff --git a/test/Rewriter/property-dot-syntax.mm b/test/Rewriter/property-dot-syntax.mm
new file mode 100644
index 0000000..965d1e7
--- /dev/null
+++ b/test/Rewriter/property-dot-syntax.mm
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// rdar:// 8520727
+
+void *sel_registerName(const char *);
+
+@class NSString;
+
+@protocol CoreDAVAccountInfoProvider
+- (NSString *)userAgentHeader;
+@end
+
+@interface CoreDAVTask
+{
+  id<CoreDAVAccountInfoProvider> _accountInfoProvider;
+}
+- (void)METHOD;
+@end
+
+@implementation CoreDAVTask
+- (void)METHOD {
+  if ([_accountInfoProvider userAgentHeader]) {
+  }
+  if (_accountInfoProvider.userAgentHeader) {
+  }
+}
+@end
+