Remove non-const form of lookupFieldDeclForIvar.

llvm-svn: 69563
This commit is contained in:
Daniel Dunbar 2009-04-20 00:37:55 +00:00
parent ae03226bc6
commit 5d5dbb1754
5 changed files with 12 additions and 12 deletions

View File

@ -428,13 +428,9 @@ public:
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; }

View File

@ -375,11 +375,12 @@ ObjCInterfaceDecl::FindCategoryDeclaration(IdentifierInfo *CategoryId) const {
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 =

View File

@ -195,7 +195,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,
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);

View File

@ -764,7 +764,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
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(
@ -1105,7 +1106,8 @@ llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
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));

View File

@ -2400,7 +2400,8 @@ llvm::Value *CGObjCMac::EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
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),