[cfe-commits] r93159 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-ivar-use.m
Fariborz Jahanian
fjahanian at apple.com
Mon Jan 11 09:50:35 PST 2010
Author: fjahanian
Date: Mon Jan 11 11:50:35 2010
New Revision: 93159
URL: http://llvm.org/viewvc/llvm-project?rev=93159&view=rev
Log:
Fixup rewrite of ivars accessed via an explicit object
in a function. Fixes radar 7522803.
Modified:
cfe/trunk/lib/Frontend/RewriteObjC.cpp
cfe/trunk/test/Rewriter/rewrite-ivar-use.m
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=93159&r1=93158&r2=93159&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Mon Jan 11 11:50:35 2010
@@ -1235,8 +1235,9 @@
// Explicit ivar refs need to have a cast inserted.
// FIXME: consider sharing some of this code with the code above.
- if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
- ObjCInterfaceType *iFaceDecl = dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
+ if (IV->isArrow()) {
+ ObjCInterfaceType *iFaceDecl =
+ dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
// lookup which class implements the instance variable.
ObjCInterfaceDecl *clsDeclared = 0;
iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
Modified: cfe/trunk/test/Rewriter/rewrite-ivar-use.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-ivar-use.m?rev=93159&r1=93158&r2=93159&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-ivar-use.m (original)
+++ cfe/trunk/test/Rewriter/rewrite-ivar-use.m Mon Jan 11 11:50:35 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fms-extensions %s -o -
// radar 7490331
@interface Foo {
@@ -10,6 +10,11 @@
@end
@implementation Foo
+// radar 7522803
+static void foo(id bar) {
+ int i = ((Foo *)bar)->a;
+}
+
- (void)bar {
a = 42;
[self baz:b];
More information about the cfe-commits
mailing list