aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-05-12 18:14:29 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-05-12 18:14:29 +0000
commit9820074dd47d37681085e964cd3392ac0b3e67b9 (patch)
tree575c9d80fa860ac265e16f5555c380a08ef8e556 /lib/CodeGen/CGObjCMac.cpp
parent278a55103a66e3a83530f15d0df3d4b80ed4cfee (diff)
Patch to implement ivar synthesis of properties declared in protocols
only and used in class imllementations (objc2 Nonfragile ABI specific). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 9d57fcb786..9418d0a255 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -53,15 +53,14 @@ static const ObjCInterfaceDecl *FindIvarInterface(ASTContext &Context,
return OID;
// Also look in synthesized ivars.
- for (ObjCInterfaceDecl::prop_iterator I = OID->prop_begin(Context),
- E = OID->prop_end(Context); I != E; ++I) {
- if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl()) {
- if (OIVD == Ivar)
- return OID;
- ++Index;
- }
+ llvm::SmallVector<ObjCIvarDecl*, 16> Ivars;
+ Context.CollectSynthesizedIvars(OID, Ivars);
+ for (unsigned k = 0, e = Ivars.size(); k != e; ++k) {
+ if (OIVD == Ivars[k])
+ return OID;
+ ++Index;
}
-
+
// Otherwise check in the super class.
if (const ObjCInterfaceDecl *Super = OID->getSuperClass())
return FindIvarInterface(Context, Super, OIVD, Index);
@@ -3153,14 +3152,13 @@ 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));
- }
-
+ llvm::SmallVector<ObjCIvarDecl*, 16> Ivars;
+ CGM.getContext().CollectSynthesizedIvars(OI, Ivars);
+ for (unsigned k = 0, e = Ivars.size(); k != e; ++k)
+ RecFields.push_back(cast<FieldDecl>(Ivars[k]));
+
if (RecFields.empty())
return llvm::Constant::getNullValue(PtrTy);
@@ -4677,10 +4675,12 @@ void CGObjCCommonMac::GetNamedIvarList(const ObjCInterfaceDecl *OID,
Res.push_back(*I);
}
- for (ObjCInterfaceDecl::prop_iterator I = OID->prop_begin(CGM.getContext()),
- E = OID->prop_end(CGM.getContext()); I != E; ++I)
- if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
- Res.push_back(IV);
+ // Also save synthesize ivars.
+ // FIXME. Why can't we just use passed in Res small vector?
+ llvm::SmallVector<ObjCIvarDecl*, 16> Ivars;
+ CGM.getContext().CollectSynthesizedIvars(OID, Ivars);
+ for (unsigned k = 0, e = Ivars.size(); k != e; ++k)
+ Res.push_back(Ivars[k]);
}
llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList(