ir-gen support for nonfragile abi's synthesized ivars.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2009-03-31 18:11:23 +00:00
Родитель 68a31d406c
Коммит 1819188655
3 изменённых файлов: 37 добавлений и 4 удалений

Просмотреть файл

@ -705,6 +705,12 @@ ASTContext::getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) {
const ObjCIvarDecl* Ivar = (*IVI);
NewEntry->LayoutField(Ivar, i++, false, StructPacking, *this);
}
// Also synthesized ivars
for (ObjCInterfaceDecl::prop_iterator I = D->prop_begin(),
E = D->prop_end(); I != E; ++I) {
if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl())
NewEntry->LayoutField(Ivar, i++, false, StructPacking, *this);
}
// Finally, round the size of the total struct up to the alignment of the
// struct itself.

Просмотреть файл

@ -1673,6 +1673,12 @@ static int countInheritedIvars(const ObjCInterfaceDecl *OI) {
for (ObjCInterfaceDecl::ivar_iterator I = OI->ivar_begin(),
E = OI->ivar_end(); I != E; ++I)
++count;
// look into properties.
for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
E = OI->prop_end(); I != E; ++I) {
if ((*I)->getPropertyIvarDecl())
++count;
}
return count;
}
@ -4559,13 +4565,20 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList(
RecordDecl::field_iterator i,p;
const RecordDecl *RD = GetFirstIvarInRecord(OID, i,p);
ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin();
// collect declared and synthesized ivars in a small vector.
llvm::SmallVector<ObjCIvarDecl*, 16> OIvars;
for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(),
E = OID->ivar_end(); I != E; ++I)
OIvars.push_back(*I);
for (ObjCInterfaceDecl::prop_iterator I = OID->prop_begin(),
E = OID->prop_end(); I != E; ++I)
if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
OIvars.push_back(IV);
unsigned iv = 0;
for (RecordDecl::field_iterator e = RD->field_end(); i != e; ++i) {
FieldDecl *Field = *i;
uint64_t offset = GetIvarBaseOffset(Layout, Field);
const ObjCIvarDecl *ivarDecl = *I++;
Ivar[0] = EmitIvarOffsetVar(ID->getClassInterface(), ivarDecl, offset);
Ivar[0] = EmitIvarOffsetVar(ID->getClassInterface(), OIvars[iv++], offset);
if (Field->getIdentifier())
Ivar[1] = GetMethodVarName(Field->getIdentifier());
else

Просмотреть файл

@ -0,0 +1,14 @@
// RUN: clang-cc -arch x86_64 -emit-llvm -o %t %s
@interface I
{
}
@property int IP;
@end
@implementation I
@synthesize IP;
- (int) Meth {
return IP;
}
@end