aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExpr.cpp9
-rw-r--r--test/Rewriter/property-dot-syntax.mm28
2 files changed, 34 insertions, 3 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index f6dc441bff..9a3cb442a7 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3289,11 +3289,14 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
// 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 0000000000..965d1e7c6f
--- /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
+