]> granicus.if.org Git - clang/commitdiff
Rewrite bug fix rewriting a property assignment when
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 14 Oct 2010 23:31:39 +0000 (23:31 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 14 Oct 2010 23:31:39 +0000 (23:31 +0000)
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

lib/Rewrite/RewriteObjC.cpp
test/Rewriter/property-dot-syntax.mm

index 8532bc7f13c3c8eea8126d9ecdb8705fe708b305..4c929a246b9453f122ec0465ce254b67db2f15e9 100644 (file)
@@ -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<ObjCIvarRefExpr>(newStmt)) {
+        bool replaced = false;
+        newStmt = RewriteObjCNestedIvarRefExpr(newStmt, replaced);
+      }
+      
       DisableReplaceStmt = false;
       //
       // Unlike the main iterator, we explicily avoid changing 'BinOp'. If
index 965d1e7c6ff2f6eb9172cf55bc8cef16c03fce0e..846bd824b537b45864e898626fc4541a84669dba 100644 (file)
@@ -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
+