[llvm-branch-commits] [cfe-branch] r119238 - in /cfe/branches/Apple/whitney: clang.xcodeproj/project.pbxproj lib/Rewrite/RewriteObjC.cpp test/Rewriter/rewrite-nested-property-in-blocks.mm

Daniel Dunbar daniel at zuster.org
Mon Nov 15 13:45:19 PST 2010


Author: ddunbar
Date: Mon Nov 15 15:45:19 2010
New Revision: 119238

URL: http://llvm.org/viewvc/llvm-project?rev=119238&view=rev
Log:
Merge r118425:
--
Author: Fariborz Jahanian <fjahanian at apple.com>
Date:   Mon Nov 8 18:37:50 2010 +0000

    Fixes a rewrite bug, rewriting nested property usage
    inside blocks. Fixes //rdar: //8608293.

Added:
    cfe/branches/Apple/whitney/test/Rewriter/rewrite-nested-property-in-blocks.mm
Modified:
    cfe/branches/Apple/whitney/clang.xcodeproj/project.pbxproj
    cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp

Modified: cfe/branches/Apple/whitney/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/clang.xcodeproj/project.pbxproj?rev=119238&r1=119237&r2=119238&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/clang.xcodeproj/project.pbxproj (original)
+++ cfe/branches/Apple/whitney/clang.xcodeproj/project.pbxproj Mon Nov 15 15:45:19 2010
@@ -2039,7 +2039,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
 			compatibilityVersion = "Xcode 2.4";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,

Modified: cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp?rev=119238&r1=119237&r2=119238&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Rewrite/RewriteObjC.cpp Mon Nov 15 15:45:19 2010
@@ -5524,7 +5524,12 @@
     GetInnerBlockDeclRefExprs(BE->getBody(),
                               InnerBlockDeclRefs, InnerContexts);
     // Rewrite the block body in place.
+    Stmt *SaveCurrentBody = CurrentBody;
+    CurrentBody = BE->getBody();
+    PropParentMap = 0;
     RewriteFunctionBodyOrGlobalInitializer(BE->getBody());
+    CurrentBody = SaveCurrentBody;
+    PropParentMap = 0;
     ImportedLocalExternalDecls.clear();
     // Now we snarf the rewritten text and stash it away for later use.
     std::string Str = Rewrite.getRewrittenText(BE->getSourceRange());

Added: cfe/branches/Apple/whitney/test/Rewriter/rewrite-nested-property-in-blocks.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/Rewriter/rewrite-nested-property-in-blocks.mm?rev=119238&view=auto
==============================================================================
--- cfe/branches/Apple/whitney/test/Rewriter/rewrite-nested-property-in-blocks.mm (added)
+++ cfe/branches/Apple/whitney/test/Rewriter/rewrite-nested-property-in-blocks.mm Mon Nov 15 15:45:19 2010
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// radar 8608293
+
+void *sel_registerName(const char *);
+
+extern "C" void nowarn(id);
+
+extern "C" void noblockwarn(void (^)());
+
+ at interface INTFOFPROP 
+ at property (readwrite, retain) INTFOFPROP *outer;
+ at property (readwrite, retain) id inner;
+ at end
+
+ at interface NSSet
+- (NSSet *)objectsPassingTest:(char (^)(id obj, char *stop))predicate ;
+ at end
+
+ at interface INTF
+- (NSSet *)Meth;
+ at end
+
+ at implementation INTF
+
+- (NSSet *)Meth
+{
+    NSSet *aces;
+
+    noblockwarn(^() {
+        INTFOFPROP *ace;
+        nowarn(ace.outer.inner);
+        noblockwarn(^() {
+          INTFOFPROP *ace;
+          nowarn(ace.outer.inner);
+        });
+    });
+
+    noblockwarn(^() {
+        INTFOFPROP *ace;
+        nowarn(ace.outer.inner);
+    });
+
+return [aces objectsPassingTest:^(id obj, char *stop)
+    {
+        INTFOFPROP *ace = (INTFOFPROP *)obj;
+        nowarn(ace.outer.inner);
+        return (char)0;
+    }];
+
+}
+ at end





More information about the llvm-branch-commits mailing list