diff options
-rw-r--r-- | lib/AST/ASTContext.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 8 | ||||
-rw-r--r-- | test/CodeGenObjC/ivar-layout-64.m | 27 |
3 files changed, 32 insertions, 12 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 0ef672768d..d89c8c2b2e 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -667,15 +667,6 @@ static void CollectLocalObjCIvars(ASTContext *Ctx, if (!IVDecl->isInvalidDecl()) Fields.push_back(cast<FieldDecl>(IVDecl)); } - // Look into properties. - // - // FIXME: This needs to go away, synthesized ivars shouldn't be - // accessible from the interface decl. - for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(*Ctx), - E = OI->prop_end(*Ctx); I != E; ++I) { - if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl()) - Fields.push_back(cast<FieldDecl>(IV)); - } } void ASTContext::CollectObjCIvars(const ObjCInterfaceDecl *OI, diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 5441b8e362..e735efb490 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -3095,6 +3095,14 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout( llvm::SmallVector<FieldDecl*, 32> RecFields; const ObjCInterfaceDecl *OI = OMD->getClassInterface(); CGM.getContext().CollectObjCIvars(OI, RecFields); + + // Add this implementations synthesized ivars. + for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(CGM.getContext()), + E = OI->prop_end(CGM.getContext()); I != E; ++I) { + if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl()) + RecFields.push_back(cast<FieldDecl>(IV)); + } + if (RecFields.empty()) return llvm::Constant::getNullValue(PtrTy); diff --git a/test/CodeGenObjC/ivar-layout-64.m b/test/CodeGenObjC/ivar-layout-64.m index 894dbfed89..0976735637 100644 --- a/test/CodeGenObjC/ivar-layout-64.m +++ b/test/CodeGenObjC/ivar-layout-64.m @@ -11,6 +11,7 @@ Here is a handy command for looking at llvm-gcc's output: llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o - ivar-layout-64.m | \ grep 'OBJC_CLASS_NAME.* =.*global' | \ sed -e 's#, section.*# ...#' | \ + sed -e 's#_[0-9]*"#_NNN#' | \ sort */ @@ -32,14 +33,34 @@ __weak B *f2; } @end +@interface C : A +@property int p3; +@end + +@implementation C +@synthesize p3 = _p3; +@end + @interface A() @property int p0; @property (assign) __strong id p1; @property (assign) __weak id p2; @end +// FIXME: Check layout for this class, once it is clear what the right +// answer is. @implementation A -@synthesize p0; -@synthesize p1; -@synthesize p2; +@synthesize p0 = _p0; +@synthesize p1 = _p1; +@synthesize p2 = _p2; +@end + +@interface D : A +@property int p3; +@end + +// FIXME: Check layout for this class, once it is clear what the right +// answer is. +@implementation D +@synthesize p3 = _p3; @end |