[cfe-commits] r120919 - in /cfe/trunk: lib/Rewrite/RewriteObjC.cpp test/Rewriter/properties.m test/Rewriter/rewrite-nested-property-in-blocks.mm
Fariborz Jahanian
fjahanian at apple.com
Sat Dec 4 13:22:13 PST 2010
Author: fjahanian
Date: Sat Dec 4 15:22:13 2010
New Revision: 120919
URL: http://llvm.org/viewvc/llvm-project?rev=120919&view=rev
Log:
Fix rewriter to match recent changes in property ref
AST.
Modified:
cfe/trunk/lib/Rewrite/RewriteObjC.cpp
cfe/trunk/test/Rewriter/properties.m
cfe/trunk/test/Rewriter/rewrite-nested-property-in-blocks.mm
Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=120919&r1=120918&r2=120919&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Sat Dec 4 15:22:13 2010
@@ -1361,12 +1361,20 @@
if (!PropParentMap)
PropParentMap = new ParentMap(CurrentBody);
-
+ bool NestedPropertyRef = false;
Stmt *Parent = PropParentMap->getParent(PropOrGetterRefExpr);
- if (Parent && isa<ObjCPropertyRefExpr>(Parent)) {
+ ImplicitCastExpr*ICE=0;
+ if (Parent)
+ if ((ICE = dyn_cast<ImplicitCastExpr>(Parent))) {
+ assert((ICE->getCastKind() == CK_GetObjCProperty)
+ && "RewritePropertyOrImplicitGetter");
+ Parent = PropParentMap->getParent(Parent);
+ NestedPropertyRef = (Parent && isa<ObjCPropertyRefExpr>(Parent));
+ }
+ if (NestedPropertyRef) {
// We stash away the ReplacingStmt since actually doing the
// replacement/rewrite won't work for nested getters (e.g. obj.p.i)
- PropGetters[PropOrGetterRefExpr] = ReplacingStmt;
+ PropGetters[ICE] = ReplacingStmt;
// NOTE: We don't want to call MsgExpr->Destroy(), as it holds references
// to things that stay around.
Context->Deallocate(MsgExpr);
Modified: cfe/trunk/test/Rewriter/properties.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/properties.m?rev=120919&r1=120918&r2=120919&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/properties.m (original)
+++ cfe/trunk/test/Rewriter/properties.m Sat Dec 4 15:22:13 2010
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -rewrite-objc %s -o -
+// 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
-// Fariborz approved this being xfail'ed during the addition
-// of explicit lvalue-to-rvalue conversions.
-// RUN: false
-// XFAIL: *
+void *sel_registerName(const char *);
@interface Foo {
int i;
Modified: cfe/trunk/test/Rewriter/rewrite-nested-property-in-blocks.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-nested-property-in-blocks.mm?rev=120919&r1=120918&r2=120919&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-nested-property-in-blocks.mm (original)
+++ cfe/trunk/test/Rewriter/rewrite-nested-property-in-blocks.mm Sat Dec 4 15:22:13 2010
@@ -2,10 +2,6 @@
// RUN: %clang_cc1 -fsyntax-only -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// radar 8608293
-// Fariborz approved this being xfail'ed during the addition
-// of explicit lvalue-to-rvalue conversions.
-// XFAIL: *
-
void *sel_registerName(const char *);
extern "C" void nowarn(id);
More information about the cfe-commits
mailing list