When dealing with an assignment with LHS being a property reference

expression, the entire assignment tree is rewritten into a property
setter messaging. This includes rewriting the RHS. 
Do not attempt to rewrite RHS again. Never rewrite a rewritten text!
Fixes //rdar: //8527018.

llvm-svn: 116104
This commit is contained in:
Fariborz Jahanian 2010-10-08 21:12:22 +00:00
parent be4092138f
commit 163488ffbf
3 changed files with 31 additions and 1 deletions

View File

@ -1102,6 +1102,7 @@
9012911C1048068D0083456D /* ASTUnit.cpp */,
1A2A54A50FD1DD1C00F4CE45 /* ASTConsumers.cpp */,
1A2A54A70FD1DD1C00F4CE45 /* CacheTokens.cpp */,
DE4DC7A20EA1C33E00069E5A /* TokenRewriter.cpp */,
1ACB57DB1105820D0047B991 /* CompilerInstance.cpp */,
1ACB57DC1105820D0047B991 /* CompilerInvocation.cpp */,
1ACB57DD1105820D0047B991 /* DeclXML.cpp */,
@ -2006,7 +2007,6 @@
72D16C1E0D9975C400E6DA4A /* HTMLRewrite.cpp */,
DEF7D9F80C9C8B1D0001F598 /* Rewriter.cpp */,
DECAB0CF0DB3C84200E13CCB /* RewriteRope.cpp */,
DE4DC7A20EA1C33E00069E5A /* TokenRewriter.cpp */,
);
name = Rewrite;
sourceTree = "<group>";

View File

@ -5363,6 +5363,15 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) {
newStmt = RewriteFunctionBodyOrGlobalInitializer(S);
if (newStmt)
*CI = newStmt;
// If dealing with an assignment with LHS being a property reference
// expression, the entire assignment tree is rewritten into a property
// setter messaging. This involvs the RHS too. Do not attempt to rewrite
// RHS again.
if (ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(S))
if (PropSetters[PRE]) {
++CI;
continue;
}
}
if (BlockExpr *BE = dyn_cast<BlockExpr>(S)) {

View File

@ -0,0 +1,21 @@
// 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:// 8527018
void *sel_registerName(const char *);
@class NSString;
@interface CoreDAVDiscoveryAccountInfo {
NSString *_scheme;
}
@property (retain) NSString *scheme;
- (void) Meth ;
@end
@implementation CoreDAVDiscoveryAccountInfo
@synthesize scheme=_scheme;
- (void) Meth {
CoreDAVDiscoveryAccountInfo *discoveryInfo;
discoveryInfo.scheme = @"https";
}
@end