From f63aa3fd429cdb9145d78f0b656bc78754efedb9 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 10 Feb 2009 19:02:04 +0000 Subject: Some refactoring of Ivar offset code gen. in preparation for nonfragile ivar offset work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64225 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 96ded8ba1b..f7bbb606a7 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1025,17 +1025,7 @@ llvm::Value *CodeGenFunction::EmitIvarOffset(ObjCInterfaceDecl *Interface, // implement the lookup itself. if (CGM.getObjCRuntime().LateBoundIVars()) assert(0 && "late-bound ivars are unsupported"); - - const llvm::Type *InterfaceLTy = - CGM.getTypes().ConvertType(getContext().getObjCInterfaceType(Interface)); - const llvm::StructLayout *Layout = - CGM.getTargetData().getStructLayout(cast(InterfaceLTy)); - FieldDecl *Field = Interface->lookupFieldDeclForIvar(getContext(), Ivar); - uint64_t Offset = - Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field)); - - return llvm::ConstantInt::get(CGM.getTypes().ConvertType(getContext().LongTy), - Offset); + return CGM.getObjCRuntime().EmitIvarOffset(*this, Interface, Ivar); } LValue CodeGenFunction::EmitLValueForIvar(QualType ObjectTy, -- cgit v1.2.3-70-g09d2