From: Fariborz Jahanian Date: Thu, 14 Oct 2010 23:31:39 +0000 (+0000) Subject: Rewrite bug fix rewriting a property assignment when X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2c6fa4eca6e4d3b2a005416746a47e85690f3a7;p=clang Rewrite bug fix rewriting a property assignment when its RHS is an ivar. Fixes //rdar: //8541517. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116539 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp index 8532bc7f13..4c929a246b 100644 --- a/lib/Rewrite/RewriteObjC.cpp +++ b/lib/Rewrite/RewriteObjC.cpp @@ -5479,6 +5479,12 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { // ^(NSURL *errorURL, NSError *error) { return (BOOL)1; }; SourceRange SrcRange = BinOp->getSourceRange(); Stmt *newStmt = RewriteFunctionBodyOrGlobalInitializer(BinOp->getRHS()); + // Need to rewrite the ivar access expression if need be. + if (isa(newStmt)) { + bool replaced = false; + newStmt = RewriteObjCNestedIvarRefExpr(newStmt, replaced); + } + DisableReplaceStmt = false; // // Unlike the main iterator, we explicily avoid changing 'BinOp'. If diff --git a/test/Rewriter/property-dot-syntax.mm b/test/Rewriter/property-dot-syntax.mm index 965d1e7c6f..846bd824b5 100644 --- a/test/Rewriter/property-dot-syntax.mm +++ b/test/Rewriter/property-dot-syntax.mm @@ -26,3 +26,21 @@ void *sel_registerName(const char *); } @end +//rdar: // 8541517 +@interface A { } +@property (retain) NSString *scheme; +@end + +@interface B : A { + NSString* _schemeName; +} +@end + + +@implementation B +-(void) test { + B *b; + b.scheme = _schemeName; // error because of this line +} +@end +