Add CGObjCRuntime::GetConcreteClassStruct to encapsulate access to the
underlying llvm::StructType for an interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69796 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index 9c3449f..2cf73b6 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -735,12 +735,7 @@
   // Get the size of instances.  For runtimes that support late-bound instances
   // this should probably be something different (size just of instance
   // varaibles in this class, not superclasses?).
-  const llvm::Type *ObjTy;
-
-  if (ClassDecl->isForwardDecl())
-    ObjTy = llvm::StructType::get(NULL, NULL);
-  else
-    ObjTy = CGM.getTypes().ConvertType(Context.getObjCInterfaceType(ClassDecl));
+  const llvm::Type *ObjTy = GetConcreteClassStruct(CGM, ClassDecl);
   int instanceSize = CGM.getTargetData().getTypePaddedSize(ObjTy);
 
   // Collect information about instance variables.
@@ -1085,9 +1080,7 @@
                          const ObjCInterfaceDecl *Interface,
                          const ObjCIvarDecl *Ivar) {
   uint64_t Offset = ComputeIvarBaseOffset(CGF.CGM, Interface, Ivar);
-  return llvm::ConstantInt::get(
-                            CGM.getTypes().ConvertType(CGM.getContext().LongTy),
-                            Offset);
+  return llvm::ConstantInt::get(LongTy, Offset);
 }
 
 CodeGen::CGObjCRuntime *CodeGen::CreateGNUObjCRuntime(CodeGen::CodeGenModule &CGM){