void setIVarList(ObjCIvarDecl * const *List, unsigned Num, ASTContext &C) {
IVars.set(List, Num, C);
}
- FieldDecl *lookupFieldDeclForIvar(ASTContext &Context,
- const ObjCIvarDecl *ivar);
const FieldDecl *lookupFieldDeclForIvar(ASTContext &Ctx,
- const ObjCIvarDecl *IV) const {
- return const_cast<ObjCInterfaceDecl*>(this)->lookupFieldDeclForIvar(Ctx,IV);
- }
+ const ObjCIvarDecl *IV) const;
bool isForwardDecl() const { return ForwardDecl; }
void setForwardDecl(bool val) { ForwardDecl = val; }
return 0;
}
-/// lookupFieldDeclForIvar - looks up a field decl' in the laid out
+/// lookupFieldDeclForIvar - looks up a field decl in the laid out
/// storage which matches this 'ivar'.
///
-FieldDecl *ObjCInterfaceDecl::lookupFieldDeclForIvar(ASTContext &Context,
- const ObjCIvarDecl *IVar) {
+const FieldDecl *
+ObjCInterfaceDecl::lookupFieldDeclForIvar(ASTContext &Context,
+ const ObjCIvarDecl *IVar) const {
const RecordDecl *RecordForDecl = Context.addRecordToClass(this);
assert(RecordForDecl && "lookupFieldDeclForIvar no storage for class");
DeclContext::lookup_const_result Lookup =
Types.ConvertType(PD->getType())));
EmitReturnOfRValue(RV, PD->getType());
} else {
- FieldDecl *Field =
+ const FieldDecl *Field =
IMP->getClassInterface()->lookupFieldDeclForIvar(getContext(), Ivar);
LValue LV = EmitLValueForIvar(TypeOfSelfObject(),
LoadObjCSelf(), Ivar, Field, 0);
Context.getObjCEncodingForType((*iter)->getType(), TypeStr);
IvarTypes.push_back(CGM.GetAddrOfConstantCString(TypeStr));
// Get the offset
- FieldDecl *Field = ClassDecl->lookupFieldDeclForIvar(Context, (*iter));
+ const FieldDecl *Field =
+ ClassDecl->lookupFieldDeclForIvar(Context, (*iter));
int offset =
(int)Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field));
IvarOffsets.push_back(
CGM.getContext().getObjCInterfaceType(Interface));
const llvm::StructLayout *Layout =
CGM.getTargetData().getStructLayout(cast<llvm::StructType>(InterfaceLTy));
- FieldDecl *Field = Interface->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
+ const FieldDecl *Field =
+ Interface->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
uint64_t Offset =
Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field));
ObjCInterfaceDecl *Interface,
const ObjCIvarDecl *Ivar) {
const llvm::StructLayout *Layout = GetInterfaceDeclStructLayout(Interface);
- FieldDecl *Field = Interface->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
+ const FieldDecl *Field =
+ Interface->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
uint64_t Offset = GetIvarBaseOffset(Layout, Field);
return llvm::ConstantInt::get(
CGM.getTypes().ConvertType(CGM.getContext().LongTy),