[cfe-commits] r69789 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Daniel Dunbar daniel at zuster.org
Wed Apr 22 01:20:38 PDT 2009


Author: ddunbar
Date: Wed Apr 22 03:20:31 2009
New Revision: 69789

URL: http://llvm.org/viewvc/llvm-project?rev=69789&view=rev
Log:
Use ComputeIvarBaseOffset instead of looking up by hand.

Modified:
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=69789&r1=69788&r2=69789&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Apr 22 03:20:31 2009
@@ -747,8 +747,6 @@
   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 @@
       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





More information about the cfe-commits mailing list