aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCGNU.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-22 08:20:31 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-22 08:20:31 +0000
commitc8cbf1944863160f5f6f82967270b68bfb41361f (patch)
tree367c03de9fe3eb65cb4d313881469a90d7ad93ae /lib/CodeGen/CGObjCGNU.cpp
parent9777687562c338601c2f17906e65e1c1a0aad96f (diff)
Use ComputeIvarBaseOffset instead of looking up by hand.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCGNU.cpp')
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index b3054cce35..9c3449f500 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -747,8 +747,6 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
llvm::SmallVector<llvm::Constant*, 16> IvarNames;
llvm::SmallVector<llvm::Constant*, 16> IvarTypes;
llvm::SmallVector<llvm::Constant*, 16> IvarOffsets;
- const llvm::StructLayout *Layout =
- CGM.getTargetData().getStructLayout(cast<llvm::StructType>(ObjTy));
ObjTy = llvm::PointerType::getUnqual(ObjTy);
for (ObjCInterfaceDecl::ivar_iterator iter = ClassDecl->ivar_begin(),
endIter = ClassDecl->ivar_end() ; iter != endIter ; iter++) {
@@ -760,12 +758,9 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
Context.getObjCEncodingForType((*iter)->getType(), TypeStr);
IvarTypes.push_back(CGM.GetAddrOfConstantCString(TypeStr));
// Get the offset
- const FieldDecl *Field =
- ClassDecl->lookupFieldDeclForIvar(Context, (*iter));
- int offset =
- (int)Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field));
+ uint64_t Offset = ComputeIvarBaseOffset(CGM, ClassDecl, *iter);
IvarOffsets.push_back(
- llvm::ConstantInt::get(llvm::Type::Int32Ty, offset));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, Offset));
}
// Collect information about instance methods