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

llvm-svn: 115934
This commit is contained in:
Fariborz Jahanian 2010-10-07 18:12:21 +00:00
parent bf70a035f0
commit 4fc98f664b
2 changed files with 34 additions and 3 deletions

View File

@ -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));
}
}

View File

@ -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