[cfe-commits] r116539 - in /cfe/trunk: lib/Rewrite/RewriteObjC.cpp test/Rewriter/property-dot-syntax.mm
Fariborz Jahanian
fjahanian at apple.com
Thu Oct 14 16:31:39 PDT 2010
Author: fjahanian
Date: Thu Oct 14 18:31:39 2010
New Revision: 116539
URL: http://llvm.org/viewvc/llvm-project?rev=116539&view=rev
Log:
Rewrite bug fix rewriting a property assignment when
its RHS is an ivar. Fixes //rdar: //8541517.
Modified:
cfe/trunk/lib/Rewrite/RewriteObjC.cpp
cfe/trunk/test/Rewriter/property-dot-syntax.mm
Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=116539&r1=116538&r2=116539&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Thu Oct 14 18:31:39 2010
@@ -5479,6 +5479,12 @@
// ^(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<ObjCIvarRefExpr>(newStmt)) {
+ bool replaced = false;
+ newStmt = RewriteObjCNestedIvarRefExpr(newStmt, replaced);
+ }
+
DisableReplaceStmt = false;
//
// Unlike the main iterator, we explicily avoid changing 'BinOp'. If
Modified: cfe/trunk/test/Rewriter/property-dot-syntax.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/property-dot-syntax.mm?rev=116539&r1=116538&r2=116539&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/property-dot-syntax.mm (original)
+++ cfe/trunk/test/Rewriter/property-dot-syntax.mm Thu Oct 14 18:31:39 2010
@@ -26,3 +26,21 @@
}
@end
+//rdar: // 8541517
+ at interface A { }
+ at property (retain) NSString *scheme;
+ at end
+
+ at interface B : A {
+ NSString* _schemeName;
+}
+ at end
+
+
+ at implementation B
+-(void) test {
+ B *b;
+ b.scheme = _schemeName; // error because of this line
+}
+ at end
+
More information about the cfe-commits
mailing list