diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-10-08 21:12:22 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-10-08 21:12:22 +0000 |
commit | 163488ffbfebb4eb33d6eb3f6c5beee6bc7aa09c (patch) | |
tree | a740cd2a50827624fcd4d107f5b587e893f4b592 /clang | |
parent | be4092138f2a431691cdf4906053ae63dda0c7fa (diff) | |
download | bcm5719-llvm-163488ffbfebb4eb33d6eb3f6c5beee6bc7aa09c.tar.gz bcm5719-llvm-163488ffbfebb4eb33d6eb3f6c5beee6bc7aa09c.zip |
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
Diffstat (limited to 'clang')
-rw-r--r-- | clang/clang.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | clang/lib/Rewrite/RewriteObjC.cpp | 9 | ||||
-rw-r--r-- | clang/test/Rewriter/rewrite-property-set-cfstring.mm | 21 |
3 files changed, 31 insertions, 1 deletions
diff --git a/clang/clang.xcodeproj/project.pbxproj b/clang/clang.xcodeproj/project.pbxproj index 2a256450887..9c95d0a3dee 100644 --- a/clang/clang.xcodeproj/project.pbxproj +++ b/clang/clang.xcodeproj/project.pbxproj @@ -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>"; diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index abd46df831c..af756c52ef6 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -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)) { diff --git a/clang/test/Rewriter/rewrite-property-set-cfstring.mm b/clang/test/Rewriter/rewrite-property-set-cfstring.mm new file mode 100644 index 00000000000..5e670bf751d --- /dev/null +++ b/clang/test/Rewriter/rewrite-property-set-cfstring.mm @@ -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 |