clang side to match the LLVM IR type system rewrite patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134831 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 98cd571..19ba868 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -65,7 +65,7 @@
   llvm::Constant *getMessageSendFn() const {
     // Add the non-lazy-bind attribute, since objc_msgSend is likely to
     // be called a lot.
-    const llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
+    llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              params, true),
                                      "objc_msgSend",
@@ -78,7 +78,7 @@
   /// by indirect reference in the first argument, and therefore the
   /// self and selector parameters are shifted over by one.
   llvm::Constant *getMessageSendStretFn() const {
-    const llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
+    llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.VoidTy,
                                                              params, true),
                                      "objc_msgSend_stret");
@@ -91,7 +91,7 @@
   /// floating-point stack; without a special entrypoint, the nil case
   /// would be unbalanced.
   llvm::Constant *getMessageSendFpretFn() const {
-    const llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
+    llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(
                                              llvm::Type::getDoubleTy(VMContext),
                                                         params, true),
@@ -105,7 +105,7 @@
   /// semantics.  The class passed is the superclass of the current
   /// class.
   llvm::Constant *getMessageSendSuperFn() const {
-    const llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy };
+    llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              params, true),
                                      "objc_msgSendSuper");
@@ -116,7 +116,7 @@
   /// A slightly different messenger used for super calls.  The class
   /// passed is the current class.
   llvm::Constant *getMessageSendSuperFn2() const {
-    const llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy };
+    llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              params, true),
                                      "objc_msgSendSuper2");
@@ -127,7 +127,7 @@
   ///
   /// The messenger used for super calls which return an aggregate indirectly.
   llvm::Constant *getMessageSendSuperStretFn() const {
-    const llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy };
+    llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy };
     return CGM.CreateRuntimeFunction(
       llvm::FunctionType::get(CGM.VoidTy, params, true),
       "objc_msgSendSuper_stret");
@@ -138,7 +138,7 @@
   ///
   /// objc_msgSendSuper_stret with the super2 semantics.
   llvm::Constant *getMessageSendSuperStretFn2() const {
-    const llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy };
+    llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy };
     return CGM.CreateRuntimeFunction(
       llvm::FunctionType::get(CGM.VoidTy, params, true),
       "objc_msgSendSuper2_stret");
@@ -158,20 +158,20 @@
   CodeGen::CodeGenModule &CGM;
 
 public:
-  const llvm::Type *ShortTy, *IntTy, *LongTy, *LongLongTy;
-  const llvm::Type *Int8PtrTy;
+  llvm::Type *ShortTy, *IntTy, *LongTy, *LongLongTy;
+  llvm::Type *Int8PtrTy;
 
   /// ObjectPtrTy - LLVM type for object handles (typeof(id))
-  const llvm::Type *ObjectPtrTy;
+  llvm::Type *ObjectPtrTy;
 
   /// PtrObjectPtrTy - LLVM type for id *
-  const llvm::Type *PtrObjectPtrTy;
+  llvm::Type *PtrObjectPtrTy;
 
   /// SelectorPtrTy - LLVM type for selector handles (typeof(SEL))
-  const llvm::Type *SelectorPtrTy;
+  llvm::Type *SelectorPtrTy;
   /// ProtocolPtrTy - LLVM type for external protocol handles
   /// (typeof(Protocol))
-  const llvm::Type *ExternalProtocolPtrTy;
+  llvm::Type *ExternalProtocolPtrTy;
 
   // SuperCTy - clang type for struct objc_super.
   QualType SuperCTy;
@@ -179,27 +179,27 @@
   QualType SuperPtrCTy;
 
   /// SuperTy - LLVM type for struct objc_super.
-  const llvm::StructType *SuperTy;
+  llvm::StructType *SuperTy;
   /// SuperPtrTy - LLVM type for struct objc_super *.
-  const llvm::Type *SuperPtrTy;
+  llvm::Type *SuperPtrTy;
 
   /// PropertyTy - LLVM type for struct objc_property (struct _prop_t
   /// in GCC parlance).
-  const llvm::StructType *PropertyTy;
+  llvm::StructType *PropertyTy;
 
   /// PropertyListTy - LLVM type for struct objc_property_list
   /// (_prop_list_t in GCC parlance).
-  const llvm::StructType *PropertyListTy;
+  llvm::StructType *PropertyListTy;
   /// PropertyListPtrTy - LLVM type for struct objc_property_list*.
-  const llvm::Type *PropertyListPtrTy;
+  llvm::Type *PropertyListPtrTy;
 
   // MethodTy - LLVM type for struct objc_method.
-  const llvm::StructType *MethodTy;
+  llvm::StructType *MethodTy;
 
   /// CacheTy - LLVM type for struct objc_cache.
-  const llvm::Type *CacheTy;
+  llvm::Type *CacheTy;
   /// CachePtrTy - LLVM type for struct objc_cache *.
-  const llvm::Type *CachePtrTy;
+  llvm::Type *CachePtrTy;
   
   llvm::Constant *getGetPropertyFn() {
     CodeGen::CodeGenTypes &Types = CGM.getTypes();
@@ -273,7 +273,7 @@
   /// GcReadWeakFn -- LLVM objc_read_weak (id *src) function.
   llvm::Constant *getGcReadWeakFn() {
     // id objc_read_weak (id *)
-    const llvm::Type *args[] = { ObjectPtrTy->getPointerTo() };
+    llvm::Type *args[] = { ObjectPtrTy->getPointerTo() };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(ObjectPtrTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_read_weak");
@@ -282,7 +282,7 @@
   /// GcAssignWeakFn -- LLVM objc_assign_weak function.
   llvm::Constant *getGcAssignWeakFn() {
     // id objc_assign_weak (id, id *)
-    const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
+    llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(ObjectPtrTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_weak");
@@ -291,7 +291,7 @@
   /// GcAssignGlobalFn -- LLVM objc_assign_global function.
   llvm::Constant *getGcAssignGlobalFn() {
     // id objc_assign_global(id, id *)
-    const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
+    llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(ObjectPtrTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_global");
@@ -300,7 +300,7 @@
   /// GcAssignThreadLocalFn -- LLVM objc_assign_threadlocal function.
   llvm::Constant *getGcAssignThreadLocalFn() {
     // id objc_assign_threadlocal(id src, id * dest)
-    const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
+    llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(ObjectPtrTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_threadlocal");
@@ -309,8 +309,8 @@
   /// GcAssignIvarFn -- LLVM objc_assign_ivar function.
   llvm::Constant *getGcAssignIvarFn() {
     // id objc_assign_ivar(id, id *, ptrdiff_t)
-    const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo(),
-                                 CGM.PtrDiffTy };
+    llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo(),
+                           CGM.PtrDiffTy };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(ObjectPtrTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_ivar");
@@ -319,7 +319,7 @@
   /// GcMemmoveCollectableFn -- LLVM objc_memmove_collectable function.
   llvm::Constant *GcMemmoveCollectableFn() {
     // void *objc_memmove_collectable(void *dst, const void *src, size_t size)
-    const llvm::Type *args[] = { Int8PtrTy, Int8PtrTy, LongTy };
+    llvm::Type *args[] = { Int8PtrTy, Int8PtrTy, LongTy };
     llvm::FunctionType *FTy = llvm::FunctionType::get(Int8PtrTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_memmove_collectable");
   }
@@ -327,7 +327,7 @@
   /// GcAssignStrongCastFn -- LLVM objc_assign_strongCast function.
   llvm::Constant *getGcAssignStrongCastFn() {
     // id objc_assign_strongCast(id, id *)
-    const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
+    llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(ObjectPtrTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_strongCast");
@@ -336,7 +336,7 @@
   /// ExceptionThrowFn - LLVM objc_exception_throw function.
   llvm::Constant *getExceptionThrowFn() {
     // void objc_exception_throw(id)
-    const llvm::Type *args[] = { ObjectPtrTy };
+    llvm::Type *args[] = { ObjectPtrTy };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(CGM.VoidTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_exception_throw");
@@ -352,7 +352,7 @@
   /// SyncEnterFn - LLVM object_sync_enter function.
   llvm::Constant *getSyncEnterFn() {
     // void objc_sync_enter (id)
-    const llvm::Type *args[] = { ObjectPtrTy };
+    llvm::Type *args[] = { ObjectPtrTy };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(CGM.VoidTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_sync_enter");
@@ -361,7 +361,7 @@
   /// SyncExitFn - LLVM object_sync_exit function.
   llvm::Constant *getSyncExitFn() {
     // void objc_sync_exit (id)
-    const llvm::Type *args[] = { ObjectPtrTy };
+    llvm::Type *args[] = { ObjectPtrTy };
     llvm::FunctionType *FTy =
       llvm::FunctionType::get(CGM.VoidTy, args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_sync_exit");
@@ -400,62 +400,62 @@
 class ObjCTypesHelper : public ObjCCommonTypesHelper {
 public:
   /// SymtabTy - LLVM type for struct objc_symtab.
-  const llvm::StructType *SymtabTy;
+  llvm::StructType *SymtabTy;
   /// SymtabPtrTy - LLVM type for struct objc_symtab *.
-  const llvm::Type *SymtabPtrTy;
+  llvm::Type *SymtabPtrTy;
   /// ModuleTy - LLVM type for struct objc_module.
-  const llvm::StructType *ModuleTy;
+  llvm::StructType *ModuleTy;
 
   /// ProtocolTy - LLVM type for struct objc_protocol.
-  const llvm::StructType *ProtocolTy;
+  llvm::StructType *ProtocolTy;
   /// ProtocolPtrTy - LLVM type for struct objc_protocol *.
-  const llvm::Type *ProtocolPtrTy;
+  llvm::Type *ProtocolPtrTy;
   /// ProtocolExtensionTy - LLVM type for struct
   /// objc_protocol_extension.
-  const llvm::StructType *ProtocolExtensionTy;
+  llvm::StructType *ProtocolExtensionTy;
   /// ProtocolExtensionTy - LLVM type for struct
   /// objc_protocol_extension *.
-  const llvm::Type *ProtocolExtensionPtrTy;
+  llvm::Type *ProtocolExtensionPtrTy;
   /// MethodDescriptionTy - LLVM type for struct
   /// objc_method_description.
-  const llvm::StructType *MethodDescriptionTy;
+  llvm::StructType *MethodDescriptionTy;
   /// MethodDescriptionListTy - LLVM type for struct
   /// objc_method_description_list.
-  const llvm::StructType *MethodDescriptionListTy;
+  llvm::StructType *MethodDescriptionListTy;
   /// MethodDescriptionListPtrTy - LLVM type for struct
   /// objc_method_description_list *.
-  const llvm::Type *MethodDescriptionListPtrTy;
+  llvm::Type *MethodDescriptionListPtrTy;
   /// ProtocolListTy - LLVM type for struct objc_property_list.
-  const llvm::Type *ProtocolListTy;
+  llvm::StructType *ProtocolListTy;
   /// ProtocolListPtrTy - LLVM type for struct objc_property_list*.
-  const llvm::Type *ProtocolListPtrTy;
+  llvm::Type *ProtocolListPtrTy;
   /// CategoryTy - LLVM type for struct objc_category.
-  const llvm::StructType *CategoryTy;
+  llvm::StructType *CategoryTy;
   /// ClassTy - LLVM type for struct objc_class.
-  const llvm::StructType *ClassTy;
+  llvm::StructType *ClassTy;
   /// ClassPtrTy - LLVM type for struct objc_class *.
-  const llvm::Type *ClassPtrTy;
+  llvm::Type *ClassPtrTy;
   /// ClassExtensionTy - LLVM type for struct objc_class_ext.
-  const llvm::StructType *ClassExtensionTy;
+  llvm::StructType *ClassExtensionTy;
   /// ClassExtensionPtrTy - LLVM type for struct objc_class_ext *.
-  const llvm::Type *ClassExtensionPtrTy;
+  llvm::Type *ClassExtensionPtrTy;
   // IvarTy - LLVM type for struct objc_ivar.
-  const llvm::StructType *IvarTy;
+  llvm::StructType *IvarTy;
   /// IvarListTy - LLVM type for struct objc_ivar_list.
-  const llvm::Type *IvarListTy;
+  llvm::Type *IvarListTy;
   /// IvarListPtrTy - LLVM type for struct objc_ivar_list *.
-  const llvm::Type *IvarListPtrTy;
+  llvm::Type *IvarListPtrTy;
   /// MethodListTy - LLVM type for struct objc_method_list.
-  const llvm::Type *MethodListTy;
+  llvm::Type *MethodListTy;
   /// MethodListPtrTy - LLVM type for struct objc_method_list *.
-  const llvm::Type *MethodListPtrTy;
+  llvm::Type *MethodListPtrTy;
 
   /// ExceptionDataTy - LLVM type for struct _objc_exception_data.
-  const llvm::Type *ExceptionDataTy;
+  llvm::Type *ExceptionDataTy;
   
   /// ExceptionTryEnterFn - LLVM objc_exception_try_enter function.
   llvm::Constant *getExceptionTryEnterFn() {
-    const llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
+    llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
     return CGM.CreateRuntimeFunction(
       llvm::FunctionType::get(CGM.VoidTy, params, false),
       "objc_exception_try_enter");
@@ -463,7 +463,7 @@
 
   /// ExceptionTryExitFn - LLVM objc_exception_try_exit function.
   llvm::Constant *getExceptionTryExitFn() {
-    const llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
+    llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
     return CGM.CreateRuntimeFunction(
       llvm::FunctionType::get(CGM.VoidTy, params, false),
       "objc_exception_try_exit");
@@ -471,7 +471,7 @@
 
   /// ExceptionExtractFn - LLVM objc_exception_extract function.
   llvm::Constant *getExceptionExtractFn() {
-    const llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
+    llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              params, false),
                                      "objc_exception_extract");
@@ -479,7 +479,7 @@
 
   /// ExceptionMatchFn - LLVM objc_exception_match function.
   llvm::Constant *getExceptionMatchFn() {
-    const llvm::Type *params[] = { ClassPtrTy, ObjectPtrTy };
+    llvm::Type *params[] = { ClassPtrTy, ObjectPtrTy };
     return CGM.CreateRuntimeFunction(
       llvm::FunctionType::get(CGM.Int32Ty, params, false),
       "objc_exception_match");
@@ -489,7 +489,7 @@
   /// SetJmpFn - LLVM _setjmp function.
   llvm::Constant *getSetJmpFn() {
     // This is specifically the prototype for x86.
-    const llvm::Type *params[] = { CGM.Int32Ty->getPointerTo() };
+    llvm::Type *params[] = { CGM.Int32Ty->getPointerTo() };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty,
                                                              params, false),
                                      "_setjmp");
@@ -506,46 +506,46 @@
 public:
 
   // MethodListnfABITy - LLVM for struct _method_list_t
-  const llvm::StructType *MethodListnfABITy;
+  llvm::StructType *MethodListnfABITy;
 
   // MethodListnfABIPtrTy - LLVM for struct _method_list_t*
-  const llvm::Type *MethodListnfABIPtrTy;
+  llvm::Type *MethodListnfABIPtrTy;
 
   // ProtocolnfABITy = LLVM for struct _protocol_t
-  const llvm::StructType *ProtocolnfABITy;
+  llvm::StructType *ProtocolnfABITy;
 
   // ProtocolnfABIPtrTy = LLVM for struct _protocol_t*
-  const llvm::Type *ProtocolnfABIPtrTy;
+  llvm::Type *ProtocolnfABIPtrTy;
 
   // ProtocolListnfABITy - LLVM for struct _objc_protocol_list
-  const llvm::StructType *ProtocolListnfABITy;
+  llvm::StructType *ProtocolListnfABITy;
 
   // ProtocolListnfABIPtrTy - LLVM for struct _objc_protocol_list*
-  const llvm::Type *ProtocolListnfABIPtrTy;
+  llvm::Type *ProtocolListnfABIPtrTy;
 
   // ClassnfABITy - LLVM for struct _class_t
-  const llvm::StructType *ClassnfABITy;
+  llvm::StructType *ClassnfABITy;
 
   // ClassnfABIPtrTy - LLVM for struct _class_t*
-  const llvm::Type *ClassnfABIPtrTy;
+  llvm::Type *ClassnfABIPtrTy;
 
   // IvarnfABITy - LLVM for struct _ivar_t
-  const llvm::StructType *IvarnfABITy;
+  llvm::StructType *IvarnfABITy;
 
   // IvarListnfABITy - LLVM for struct _ivar_list_t
-  const llvm::StructType *IvarListnfABITy;
+  llvm::StructType *IvarListnfABITy;
 
   // IvarListnfABIPtrTy = LLVM for struct _ivar_list_t*
-  const llvm::Type *IvarListnfABIPtrTy;
+  llvm::Type *IvarListnfABIPtrTy;
 
   // ClassRonfABITy - LLVM for struct _class_ro_t
-  const llvm::StructType *ClassRonfABITy;
+  llvm::StructType *ClassRonfABITy;
 
   // ImpnfABITy - LLVM for id (*)(id, SEL, ...)
-  const llvm::Type *ImpnfABITy;
+  llvm::Type *ImpnfABITy;
 
   // CategorynfABITy - LLVM for struct _category_t
-  const llvm::StructType *CategorynfABITy;
+  llvm::StructType *CategorynfABITy;
 
   // New types for nonfragile abi messaging.
 
@@ -554,31 +554,31 @@
   //   IMP messenger;
   //   SEL name;
   // };
-  const llvm::StructType *MessageRefTy;
+  llvm::StructType *MessageRefTy;
   // MessageRefCTy - clang type for struct _message_ref_t
   QualType MessageRefCTy;
 
   // MessageRefPtrTy - LLVM for struct _message_ref_t*
-  const llvm::Type *MessageRefPtrTy;
+  llvm::Type *MessageRefPtrTy;
   // MessageRefCPtrTy - clang type for struct _message_ref_t*
   QualType MessageRefCPtrTy;
 
   // MessengerTy - Type of the messenger (shown as IMP above)
-  const llvm::FunctionType *MessengerTy;
+  llvm::FunctionType *MessengerTy;
 
   // SuperMessageRefTy - LLVM for:
   // struct _super_message_ref_t {
   //   SUPER_IMP messenger;
   //   SEL name;
   // };
-  const llvm::StructType *SuperMessageRefTy;
+  llvm::StructType *SuperMessageRefTy;
 
   // SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t*
-  const llvm::Type *SuperMessageRefPtrTy;
+  llvm::Type *SuperMessageRefPtrTy;
 
   llvm::Constant *getMessageSendFixupFn() {
     // id objc_msgSend_fixup(id, struct message_ref_t*, ...)
-    const llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
+    llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              params, true),
                                      "objc_msgSend_fixup");
@@ -586,7 +586,7 @@
 
   llvm::Constant *getMessageSendFpretFixupFn() {
     // id objc_msgSend_fpret_fixup(id, struct message_ref_t*, ...)
-    const llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
+    llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              params, true),
                                      "objc_msgSend_fpret_fixup");
@@ -594,7 +594,7 @@
 
   llvm::Constant *getMessageSendStretFixupFn() {
     // id objc_msgSend_stret_fixup(id, struct message_ref_t*, ...)
-    const llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
+    llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              params, true),
                                      "objc_msgSend_stret_fixup");
@@ -603,7 +603,7 @@
   llvm::Constant *getMessageSendSuper2FixupFn() {
     // id objc_msgSendSuper2_fixup (struct objc_super *,
     //                              struct _super_message_ref_t*, ...)
-    const llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy };
+    llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy };
     return  CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                               params, true),
                                       "objc_msgSendSuper2_fixup");
@@ -612,7 +612,7 @@
   llvm::Constant *getMessageSendSuper2StretFixupFn() {
     // id objc_msgSendSuper2_stret_fixup(struct objc_super *,
     //                                   struct _super_message_ref_t*, ...)
-    const llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy };
+    llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy };
     return  CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                               params, true),
                                       "objc_msgSendSuper2_stret_fixup");
@@ -625,14 +625,14 @@
   }
 
   llvm::Constant *getObjCBeginCatchFn() {
-    const llvm::Type *params[] = { Int8PtrTy };
+    llvm::Type *params[] = { Int8PtrTy };
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(Int8PtrTy,
                                                              params, false),
                                      "objc_begin_catch");
   }
 
-  const llvm::StructType *EHTypeTy;
-  const llvm::Type *EHTypePtrTy;
+  llvm::StructType *EHTypeTy;
+  llvm::Type *EHTypePtrTy;
   
   ObjCNonFragileABITypesHelper(CodeGen::CodeGenModule &cgm);
   ~ObjCNonFragileABITypesHelper(){}
@@ -2768,7 +2768,7 @@
 }
 
 llvm::FunctionType *FragileHazards::GetAsmFnType() {
-  llvm::SmallVector<const llvm::Type *, 16> tys(Locals.size());
+  llvm::SmallVector<llvm::Type *, 16> tys(Locals.size());
   for (unsigned i = 0, e = Locals.size(); i != e; ++i)
     tys[i] = Locals[i]->getType();
   return llvm::FunctionType::get(CGF.VoidTy, tys, false);
@@ -4162,20 +4162,19 @@
   //   char *name;
   //   char *attributes;
   // }
-  PropertyTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, NULL);
-  CGM.getModule().addTypeName("struct._prop_t",
-                              PropertyTy);
+  PropertyTy = llvm::StructType::createNamed("struct._prop_t",
+                                             Int8PtrTy, Int8PtrTy, NULL);
 
   // struct _prop_list_t {
   //   uint32_t entsize;      // sizeof(struct _prop_t)
   //   uint32_t count_of_properties;
   //   struct _prop_t prop_list[count_of_properties];
   // }
-  PropertyListTy = llvm::StructType::get(IntTy, IntTy,
-                                         llvm::ArrayType::get(PropertyTy, 0),
-                                         NULL);
-  CGM.getModule().addTypeName("struct._prop_list_t",
-                              PropertyListTy);
+  PropertyListTy =
+    llvm::StructType::createNamed("struct._prop_list_t",
+                                  IntTy, IntTy,
+                                  llvm::ArrayType::get(PropertyTy, 0),
+                                  NULL);
   // struct _prop_list_t *
   PropertyListPtrTy = llvm::PointerType::getUnqual(PropertyListTy);
 
@@ -4184,12 +4183,12 @@
   //   char *method_type;
   //   char *_imp;
   // }
-  MethodTy = llvm::StructType::get(SelectorPtrTy, Int8PtrTy, Int8PtrTy, NULL);
-  CGM.getModule().addTypeName("struct._objc_method", MethodTy);
+  MethodTy = llvm::StructType::createNamed("struct._objc_method",
+                                           SelectorPtrTy, Int8PtrTy, Int8PtrTy,
+                                           NULL);
 
   // struct _objc_cache *
-  CacheTy = llvm::OpaqueType::get(VMContext);
-  CGM.getModule().addTypeName("struct._objc_cache", CacheTy);
+  CacheTy = llvm::StructType::createNamed(VMContext, "struct._objc_cache");
   CachePtrTy = llvm::PointerType::getUnqual(CacheTy);
     
 }
@@ -4201,19 +4200,18 @@
   //   char *types;
   // }
   MethodDescriptionTy =
-    llvm::StructType::get(SelectorPtrTy, Int8PtrTy, NULL);
-  CGM.getModule().addTypeName("struct._objc_method_description",
-                              MethodDescriptionTy);
+    llvm::StructType::createNamed("struct._objc_method_description",
+                                  SelectorPtrTy, Int8PtrTy, NULL);
 
   // struct _objc_method_description_list {
   //   int count;
   //   struct _objc_method_description[1];
   // }
   MethodDescriptionListTy =
-    llvm::StructType::get(IntTy, llvm::ArrayType::get(MethodDescriptionTy, 0),
-                          NULL);
-  CGM.getModule().addTypeName("struct._objc_method_description_list",
-                              MethodDescriptionListTy);
+    llvm::StructType::createNamed("struct._objc_method_description_list",
+                                  IntTy,
+                                  llvm::ArrayType::get(MethodDescriptionTy, 0),
+                                  NULL);
 
   // struct _objc_method_description_list *
   MethodDescriptionListPtrTy =
@@ -4228,28 +4226,27 @@
   //   struct _objc_property_list *instance_properties;
   // }
   ProtocolExtensionTy =
-    llvm::StructType::get(IntTy,
-                          MethodDescriptionListPtrTy,
-                          MethodDescriptionListPtrTy,
-                          PropertyListPtrTy,
-                          NULL);
-  CGM.getModule().addTypeName("struct._objc_protocol_extension",
-                              ProtocolExtensionTy);
+    llvm::StructType::createNamed("struct._objc_protocol_extension",
+                                  IntTy,
+                                  MethodDescriptionListPtrTy,
+                                  MethodDescriptionListPtrTy,
+                                  PropertyListPtrTy,
+                                  NULL);
 
   // struct _objc_protocol_extension *
   ProtocolExtensionPtrTy = llvm::PointerType::getUnqual(ProtocolExtensionTy);
 
   // Handle recursive construction of Protocol and ProtocolList types
 
-  llvm::PATypeHolder ProtocolTyHolder = llvm::OpaqueType::get(VMContext);
-  llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get(VMContext);
+  ProtocolTy =
+    llvm::StructType::createNamed(VMContext, "struct._objc_protocol");
 
-  const llvm::Type *T =
-    llvm::StructType::get(llvm::PointerType::getUnqual(ProtocolListTyHolder),
+  ProtocolListTy =
+    llvm::StructType::createNamed(VMContext, "struct._objc_protocol_list");
+  ProtocolListTy->setBody(llvm::PointerType::getUnqual(ProtocolListTy),
                           LongTy,
-                          llvm::ArrayType::get(ProtocolTyHolder, 0),
+                          llvm::ArrayType::get(ProtocolTy, 0),
                           NULL);
-  cast<llvm::OpaqueType>(ProtocolListTyHolder.get())->refineAbstractTypeTo(T);
 
   // struct _objc_protocol {
   //   struct _objc_protocol_extension *isa;
@@ -4258,21 +4255,15 @@
   //   struct _objc_method_description_list *instance_methods;
   //   struct _objc_method_description_list *class_methods;
   // }
-  T = llvm::StructType::get(ProtocolExtensionPtrTy, Int8PtrTy,
-                            llvm::PointerType::getUnqual(ProtocolListTyHolder),
-                            MethodDescriptionListPtrTy,
-                            MethodDescriptionListPtrTy,
-                            NULL);
-  cast<llvm::OpaqueType>(ProtocolTyHolder.get())->refineAbstractTypeTo(T);
+  ProtocolTy->setBody(ProtocolExtensionPtrTy, Int8PtrTy,
+                      llvm::PointerType::getUnqual(ProtocolListTy),
+                      MethodDescriptionListPtrTy,
+                      MethodDescriptionListPtrTy,
+                      NULL);
 
-  ProtocolListTy = cast<llvm::StructType>(ProtocolListTyHolder.get());
-  CGM.getModule().addTypeName("struct._objc_protocol_list",
-                              ProtocolListTy);
   // struct _objc_protocol_list *
   ProtocolListPtrTy = llvm::PointerType::getUnqual(ProtocolListTy);
 
-  ProtocolTy = cast<llvm::StructType>(ProtocolTyHolder.get());
-  CGM.getModule().addTypeName("struct._objc_protocol", ProtocolTy);
   ProtocolPtrTy = llvm::PointerType::getUnqual(ProtocolTy);
 
   // Class description structures
@@ -4282,26 +4273,26 @@
   //   char *ivar_type;
   //   int  ivar_offset;
   // }
-  IvarTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, IntTy, NULL);
-  CGM.getModule().addTypeName("struct._objc_ivar", IvarTy);
+  IvarTy = llvm::StructType::createNamed("struct._objc_ivar",
+                                         Int8PtrTy, Int8PtrTy, IntTy, NULL);
 
   // struct _objc_ivar_list *
-  IvarListTy = llvm::OpaqueType::get(VMContext);
-  CGM.getModule().addTypeName("struct._objc_ivar_list", IvarListTy);
+  IvarListTy =
+    llvm::StructType::createNamed(VMContext, "struct._objc_ivar_list");
   IvarListPtrTy = llvm::PointerType::getUnqual(IvarListTy);
 
   // struct _objc_method_list *
-  MethodListTy = llvm::OpaqueType::get(VMContext);
-  CGM.getModule().addTypeName("struct._objc_method_list", MethodListTy);
+  MethodListTy =
+    llvm::StructType::createNamed(VMContext, "struct._objc_method_list");
   MethodListPtrTy = llvm::PointerType::getUnqual(MethodListTy);
 
   // struct _objc_class_extension *
   ClassExtensionTy =
-    llvm::StructType::get(IntTy, Int8PtrTy, PropertyListPtrTy, NULL);
-  CGM.getModule().addTypeName("struct._objc_class_extension", ClassExtensionTy);
+    llvm::StructType::createNamed("struct._objc_class_extension",
+                                  IntTy, Int8PtrTy, PropertyListPtrTy, NULL);
   ClassExtensionPtrTy = llvm::PointerType::getUnqual(ClassExtensionTy);
 
-  llvm::PATypeHolder ClassTyHolder = llvm::OpaqueType::get(VMContext);
+  ClassTy = llvm::StructType::createNamed(VMContext, "struct._objc_class");
 
   // struct _objc_class {
   //   Class isa;
@@ -4317,23 +4308,20 @@
   //   char *ivar_layout;
   //   struct _objc_class_ext *ext;
   // };
-  T = llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
-                            llvm::PointerType::getUnqual(ClassTyHolder),
-                            Int8PtrTy,
-                            LongTy,
-                            LongTy,
-                            LongTy,
-                            IvarListPtrTy,
-                            MethodListPtrTy,
-                            CachePtrTy,
-                            ProtocolListPtrTy,
-                            Int8PtrTy,
-                            ClassExtensionPtrTy,
-                            NULL);
-  cast<llvm::OpaqueType>(ClassTyHolder.get())->refineAbstractTypeTo(T);
+  ClassTy->setBody(llvm::PointerType::getUnqual(ClassTy),
+                   llvm::PointerType::getUnqual(ClassTy),
+                   Int8PtrTy,
+                   LongTy,
+                   LongTy,
+                   LongTy,
+                   IvarListPtrTy,
+                   MethodListPtrTy,
+                   CachePtrTy,
+                   ProtocolListPtrTy,
+                   Int8PtrTy,
+                   ClassExtensionPtrTy,
+                   NULL);
 
-  ClassTy = cast<llvm::StructType>(ClassTyHolder.get());
-  CGM.getModule().addTypeName("struct._objc_class", ClassTy);
   ClassPtrTy = llvm::PointerType::getUnqual(ClassTy);
 
   // struct _objc_category {
@@ -4344,10 +4332,11 @@
   //   uint32_t size;  // sizeof(struct _objc_category)
   //   struct _objc_property_list *instance_properties;// category's @property
   // }
-  CategoryTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, MethodListPtrTy,
-                                     MethodListPtrTy, ProtocolListPtrTy,
-                                     IntTy, PropertyListPtrTy, NULL);
-  CGM.getModule().addTypeName("struct._objc_category", CategoryTy);
+  CategoryTy =
+    llvm::StructType::createNamed("struct._objc_category",
+                                  Int8PtrTy, Int8PtrTy, MethodListPtrTy,
+                                  MethodListPtrTy, ProtocolListPtrTy,
+                                  IntTy, PropertyListPtrTy, NULL);
 
   // Global metadata structures
 
@@ -4358,9 +4347,10 @@
   //   short cat_def_cnt;
   //   char *defs[cls_def_cnt + cat_def_cnt];
   // }
-  SymtabTy = llvm::StructType::get(LongTy, SelectorPtrTy, ShortTy, ShortTy,
-                                   llvm::ArrayType::get(Int8PtrTy, 0), NULL);
-  CGM.getModule().addTypeName("struct._objc_symtab", SymtabTy);
+  SymtabTy =
+    llvm::StructType::createNamed("struct._objc_symtab",
+                                  LongTy, SelectorPtrTy, ShortTy, ShortTy,
+                                  llvm::ArrayType::get(Int8PtrTy, 0), NULL);
   SymtabPtrTy = llvm::PointerType::getUnqual(SymtabTy);
 
   // struct _objc_module {
@@ -4370,8 +4360,8 @@
   //   struct _objc_symtab* symtab;
   //  }
   ModuleTy =
-    llvm::StructType::get(LongTy, LongTy, Int8PtrTy, SymtabPtrTy, NULL);
-  CGM.getModule().addTypeName("struct._objc_module", ModuleTy);
+    llvm::StructType::createNamed("struct._objc_module",
+                                  LongTy, LongTy, Int8PtrTy, SymtabPtrTy, NULL);
 
 
   // FIXME: This is the size of the setjmp buffer and should be target
@@ -4379,16 +4369,14 @@
   uint64_t SetJmpBufferSize = 18;
 
   // Exceptions
-  const llvm::Type *StackPtrTy = llvm::ArrayType::get(
+  llvm::Type *StackPtrTy = llvm::ArrayType::get(
     llvm::Type::getInt8PtrTy(VMContext), 4);
 
   ExceptionDataTy =
-    llvm::StructType::get(
-                        llvm::ArrayType::get(llvm::Type::getInt32Ty(VMContext),
-                                             SetJmpBufferSize),
-                          StackPtrTy, NULL);
-  CGM.getModule().addTypeName("struct._objc_exception_data",
-                              ExceptionDataTy);
+    llvm::StructType::createNamed("struct._objc_exception_data",
+                         llvm::ArrayType::get(llvm::Type::getInt32Ty(VMContext),
+                                              SetJmpBufferSize),
+                         StackPtrTy, NULL);
 
 }
 
@@ -4399,11 +4387,11 @@
   //   uint32_t method_count;
   //   struct _objc_method method_list[method_count];
   // }
-  MethodListnfABITy = llvm::StructType::get(IntTy, IntTy,
-                                            llvm::ArrayType::get(MethodTy, 0),
-                                            NULL);
-  CGM.getModule().addTypeName("struct.__method_list_t",
-                              MethodListnfABITy);
+  MethodListnfABITy =
+    llvm::StructType::createNamed("struct.__method_list_t",
+                                  IntTy, IntTy,
+                                  llvm::ArrayType::get(MethodTy, 0),
+                                  NULL);
   // struct method_list_t *
   MethodListnfABIPtrTy = llvm::PointerType::getUnqual(MethodListnfABITy);
 
@@ -4421,20 +4409,21 @@
   // }
 
   // Holder for struct _protocol_list_t *
-  llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get(VMContext);
+  ProtocolListnfABITy =
+    llvm::StructType::createNamed(VMContext, "struct._objc_protocol_list");
 
-  ProtocolnfABITy = llvm::StructType::get(ObjectPtrTy, Int8PtrTy,
-                                          ProtocolListTyHolder->getPointerTo(),
-                                          MethodListnfABIPtrTy,
-                                          MethodListnfABIPtrTy,
-                                          MethodListnfABIPtrTy,
-                                          MethodListnfABIPtrTy,
-                                          PropertyListPtrTy,
-                                          IntTy,
-                                          IntTy,
-                                          NULL);
-  CGM.getModule().addTypeName("struct._protocol_t",
-                              ProtocolnfABITy);
+  ProtocolnfABITy =
+    llvm::StructType::createNamed("struct._protocol_t",
+                                  ObjectPtrTy, Int8PtrTy,
+                              llvm::PointerType::getUnqual(ProtocolListnfABITy),
+                                  MethodListnfABIPtrTy,
+                                  MethodListnfABIPtrTy,
+                                  MethodListnfABIPtrTy,
+                                  MethodListnfABIPtrTy,
+                                  PropertyListPtrTy,
+                                  IntTy,
+                                  IntTy,
+                                  NULL);
 
   // struct _protocol_t*
   ProtocolnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolnfABITy);
@@ -4443,14 +4432,9 @@
   //   long protocol_count;   // Note, this is 32/64 bit
   //   struct _protocol_t *[protocol_count];
   // }
-  ProtocolListnfABITy = llvm::StructType::get(LongTy,
-                                              llvm::ArrayType::get(
-                                                ProtocolnfABIPtrTy, 0),
-                                              NULL);
-  CGM.getModule().addTypeName("struct._objc_protocol_list",
-                              ProtocolListnfABITy);
-  cast<llvm::OpaqueType>(ProtocolListTyHolder.get())->refineAbstractTypeTo(
-    ProtocolListnfABITy);
+  ProtocolListnfABITy->setBody(LongTy,
+                               llvm::ArrayType::get(ProtocolnfABIPtrTy, 0),
+                               NULL);
 
   // struct _objc_protocol_list*
   ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolListnfABITy);
@@ -4462,24 +4446,25 @@
   //   uint32_t alignment;
   //   uint32_t size;
   // }
-  IvarnfABITy = llvm::StructType::get(llvm::PointerType::getUnqual(LongTy),
-                                      Int8PtrTy,
-                                      Int8PtrTy,
-                                      IntTy,
-                                      IntTy,
-                                      NULL);
-  CGM.getModule().addTypeName("struct._ivar_t", IvarnfABITy);
+  IvarnfABITy =
+    llvm::StructType::createNamed("struct._ivar_t",
+                                  llvm::PointerType::getUnqual(LongTy),
+                                  Int8PtrTy,
+                                  Int8PtrTy,
+                                  IntTy,
+                                  IntTy,
+                                  NULL);
 
   // struct _ivar_list_t {
   //   uint32 entsize;  // sizeof(struct _ivar_t)
   //   uint32 count;
   //   struct _iver_t list[count];
   // }
-  IvarListnfABITy = llvm::StructType::get(IntTy, IntTy,
-                                          llvm::ArrayType::get(
-                                            IvarnfABITy, 0),
-                                          NULL);
-  CGM.getModule().addTypeName("struct._ivar_list_t", IvarListnfABITy);
+  IvarListnfABITy =
+    llvm::StructType::createNamed("struct._ivar_list_t",
+                                  IntTy, IntTy,
+                                  llvm::ArrayType::get(IvarnfABITy, 0),
+                                  NULL);
 
   IvarListnfABIPtrTy = llvm::PointerType::getUnqual(IvarListnfABITy);
 
@@ -4498,22 +4483,21 @@
   // }
 
   // FIXME. Add 'reserved' field in 64bit abi mode!
-  ClassRonfABITy = llvm::StructType::get(IntTy,
-                                         IntTy,
-                                         IntTy,
-                                         Int8PtrTy,
-                                         Int8PtrTy,
-                                         MethodListnfABIPtrTy,
-                                         ProtocolListnfABIPtrTy,
-                                         IvarListnfABIPtrTy,
-                                         Int8PtrTy,
-                                         PropertyListPtrTy,
-                                         NULL);
-  CGM.getModule().addTypeName("struct._class_ro_t",
-                              ClassRonfABITy);
+  ClassRonfABITy = llvm::StructType::createNamed("struct._class_ro_t",
+                                                 IntTy,
+                                                 IntTy,
+                                                 IntTy,
+                                                 Int8PtrTy,
+                                                 Int8PtrTy,
+                                                 MethodListnfABIPtrTy,
+                                                 ProtocolListnfABIPtrTy,
+                                                 IvarListnfABIPtrTy,
+                                                 Int8PtrTy,
+                                                 PropertyListPtrTy,
+                                                 NULL);
 
   // ImpnfABITy - LLVM for id (*)(id, SEL, ...)
-  const llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
+  llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
   ImpnfABITy = llvm::FunctionType::get(ObjectPtrTy, params, false)
                  ->getPointerTo();
 
@@ -4525,18 +4509,13 @@
   //   struct class_ro_t *ro;
   // }
 
-  llvm::PATypeHolder ClassTyHolder = llvm::OpaqueType::get(VMContext);
-  ClassnfABITy =
-    llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
-                          llvm::PointerType::getUnqual(ClassTyHolder),
-                          CachePtrTy,
-                          llvm::PointerType::getUnqual(ImpnfABITy),
-                          llvm::PointerType::getUnqual(ClassRonfABITy),
-                          NULL);
-  CGM.getModule().addTypeName("struct._class_t", ClassnfABITy);
-
-  cast<llvm::OpaqueType>(ClassTyHolder.get())->refineAbstractTypeTo(
-    ClassnfABITy);
+  ClassnfABITy = llvm::StructType::createNamed(VMContext, "struct._class_t");
+  ClassnfABITy->setBody(llvm::PointerType::getUnqual(ClassnfABITy),
+                        llvm::PointerType::getUnqual(ClassnfABITy),
+                        CachePtrTy,
+                        llvm::PointerType::getUnqual(ImpnfABITy),
+                        llvm::PointerType::getUnqual(ClassRonfABITy),
+                        NULL);
 
   // LLVM for struct _class_t *
   ClassnfABIPtrTy = llvm::PointerType::getUnqual(ClassnfABITy);
@@ -4549,14 +4528,14 @@
   //   const struct _protocol_list_t * const protocols;
   //   const struct _prop_list_t * const properties;
   // }
-  CategorynfABITy = llvm::StructType::get(Int8PtrTy,
-                                          ClassnfABIPtrTy,
-                                          MethodListnfABIPtrTy,
-                                          MethodListnfABIPtrTy,
-                                          ProtocolListnfABIPtrTy,
-                                          PropertyListPtrTy,
-                                          NULL);
-  CGM.getModule().addTypeName("struct._category_t", CategorynfABITy);
+  CategorynfABITy = llvm::StructType::createNamed("struct._category_t",
+                                                  Int8PtrTy,
+                                                  ClassnfABIPtrTy,
+                                                  MethodListnfABIPtrTy,
+                                                  MethodListnfABIPtrTy,
+                                                  ProtocolListnfABIPtrTy,
+                                                  PropertyListPtrTy,
+                                                  NULL);
 
   // New types for nonfragile abi messaging.
   CodeGen::CodeGenTypes &Types = CGM.getTypes();
@@ -4591,8 +4570,9 @@
   //   SUPER_IMP messenger;
   //   SEL name;
   // };
-  SuperMessageRefTy = llvm::StructType::get(ImpnfABITy, SelectorPtrTy, NULL);
-  CGM.getModule().addTypeName("struct._super_message_ref_t", SuperMessageRefTy);
+  SuperMessageRefTy =
+    llvm::StructType::createNamed("struct._super_message_ref_t",
+                                  ImpnfABITy, SelectorPtrTy, NULL);
 
   // SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t*
   SuperMessageRefPtrTy = llvm::PointerType::getUnqual(SuperMessageRefTy);
@@ -4603,11 +4583,12 @@
   //   const char*  name;    // c++ typeinfo string
   //   Class        cls;
   // };
-  EHTypeTy = llvm::StructType::get(llvm::PointerType::getUnqual(Int8PtrTy),
-                                   Int8PtrTy,
-                                   ClassnfABIPtrTy,
-                                   NULL);
-  CGM.getModule().addTypeName("struct._objc_typeinfo", EHTypeTy);
+  EHTypeTy =
+    llvm::StructType::createNamed("struct._objc_typeinfo",
+                                  llvm::PointerType::getUnqual(Int8PtrTy),
+                                  Int8PtrTy,
+                                  ClassnfABIPtrTy,
+                                  NULL);
   EHTypePtrTy = llvm::PointerType::getUnqual(EHTypeTy);
 }