[cfe-commits] r68234 - in /cfe/trunk: lib/AST/ASTContext.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/synthesize_ivar.m
Fariborz Jahanian
fjahanian at apple.com
Wed Apr 1 12:37:34 PDT 2009
Author: fjahanian
Date: Wed Apr 1 14:37:34 2009
New Revision: 68234
URL: http://llvm.org/viewvc/llvm-project?rev=68234&view=rev
Log:
Nonfragile ivar synthesis with property is in a continuation
class.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/test/CodeGenObjC/synthesize_ivar.m
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=68234&r1=68233&r2=68234&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Apr 1 14:37:34 2009
@@ -614,6 +614,17 @@
if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
Fields.push_back(cast<FieldDecl>(IV));
}
+ // look into continuation class.
+ for (ObjCCategoryDecl *Categories = OI->getCategoryList();
+ Categories; Categories = Categories->getNextClassCategory())
+ if (!Categories->getIdentifier()) {
+ for (ObjCInterfaceDecl::prop_iterator I = Categories->prop_begin(),
+ E = Categories->prop_end(); I != E; ++I) {
+ if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
+ Fields.push_back(cast<FieldDecl>(IV));
+ }
+ break;
+ }
}
/// addRecordToClass - produces record info. for the class for its
@@ -711,7 +722,18 @@
if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl())
NewEntry->LayoutField(Ivar, i++, false, StructPacking, *this);
}
-
+ // Also continuation class.
+ for (ObjCCategoryDecl *Categories = D->getCategoryList();
+ Categories; Categories = Categories->getNextClassCategory())
+ if (!Categories->getIdentifier()) {
+ for (ObjCInterfaceDecl::prop_iterator I = Categories->prop_begin(),
+ E = Categories->prop_end(); I != E; ++I) {
+ if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl())
+ NewEntry->LayoutField(Ivar, i++, false, StructPacking, *this);
+ }
+ break;
+ }
+
// Finally, round the size of the total struct up to the alignment of the
// struct itself.
NewEntry->FinalizeLayout();
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=68234&r1=68233&r2=68234&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Wed Apr 1 14:37:34 2009
@@ -147,6 +147,22 @@
return IV;
}
}
+ // look into continuation class.
+ for (ObjCCategoryDecl *Categories = ClassDecl->getCategoryList();
+ Categories; Categories = Categories->getNextClassCategory())
+ if (!Categories->getIdentifier()) {
+ for (ObjCInterfaceDecl::prop_iterator I = Categories->prop_begin(),
+ E = Categories->prop_end(); I != E; ++I) {
+ ObjCPropertyDecl *PDecl = (*I);
+ if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl())
+ if (IV->getIdentifier() == ID) {
+ clsDeclared = ClassDecl;
+ return IV;
+ }
+ }
+ break;
+ }
+
ClassDecl = ClassDecl->getSuperClass();
}
return NULL;
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=68234&r1=68233&r2=68234&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Apr 1 14:37:34 2009
@@ -1674,6 +1674,18 @@
if ((*I)->getPropertyIvarDecl())
++count;
}
+ // look into continuation class.
+ for (ObjCCategoryDecl *Categories = OI->getCategoryList();
+ Categories; Categories = Categories->getNextClassCategory()) {
+ if (!Categories->getIdentifier()) {
+ for (ObjCInterfaceDecl::prop_iterator I = Categories->prop_begin(),
+ E = Categories->prop_end(); I != E; ++I) {
+ if ((*I)->getPropertyIvarDecl())
+ ++count;
+ }
+ break;
+ }
+ }
return count;
}
@@ -1702,6 +1714,20 @@
if (IV->getIdentifier() == IVD->getIdentifier())
return OI;
}
+ // look into continuation class.
+ for (ObjCCategoryDecl *Categories = OI->getCategoryList();
+ Categories; Categories = Categories->getNextClassCategory()) {
+ if (!Categories->getIdentifier()) {
+ for (ObjCInterfaceDecl::prop_iterator I = Categories->prop_begin(),
+ E = Categories->prop_end(); I != E; ++I) {
+ ObjCPropertyDecl *PDecl = (*I);
+ if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl())
+ if (IV->getIdentifier() == IVD->getIdentifier())
+ return OI;
+ }
+ break;
+ }
+ }
return getInterfaceDeclForIvar(OI->getSuperClass(), IVD);
}
@@ -4566,6 +4592,18 @@
E = OID->prop_end(); I != E; ++I)
if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
OIvars.push_back(IV);
+ // look into continuation class.
+ for (ObjCCategoryDecl *Categories = OID->getCategoryList();
+ Categories; Categories = Categories->getNextClassCategory())
+ if (!Categories->getIdentifier()) {
+ for (ObjCInterfaceDecl::prop_iterator I = Categories->prop_begin(),
+ E = Categories->prop_end(); I != E; ++I) {
+ if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
+ OIvars.push_back(IV);
+ }
+ break;
+ }
+
unsigned iv = 0;
for (RecordDecl::field_iterator e = RD->field_end(); i != e; ++i) {
FieldDecl *Field = *i;
Modified: cfe/trunk/test/CodeGenObjC/synthesize_ivar.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/synthesize_ivar.m?rev=68234&r1=68233&r2=68234&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/synthesize_ivar.m (original)
+++ cfe/trunk/test/CodeGenObjC/synthesize_ivar.m Wed Apr 1 14:37:34 2009
@@ -12,3 +12,16 @@
return IP;
}
@end
+
+// Test for synthesis of ivar for a property
+// declared in continuation class.
+ at interface OrganizerViolatorView
+ at end
+
+ at interface OrganizerViolatorView()
+ at property (retain) id bindingInfo;
+ at end
+
+ at implementation OrganizerViolatorView
+ at synthesize bindingInfo;
+ at end
More information about the cfe-commits
mailing list