r233766 - [Objective-C metadata patch]. Patch to allocate one more space for

Fariborz Jahanian fjahanian at apple.com
Tue Mar 31 15:22:40 PDT 2015


Author: fjahanian
Date: Tue Mar 31 17:22:40 2015
New Revision: 233766

URL: http://llvm.org/viewvc/llvm-project?rev=233766&view=rev
Log:
[Objective-C metadata patch]. Patch to allocate one more space for 
Protocol objects in OBJC2. rdar://20286356

Added:
    cfe/trunk/test/CodeGenObjC/objc2-protocol-metadata.m
Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=233766&r1=233765&r2=233766&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Mar 31 17:22:40 2015
@@ -5264,6 +5264,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
   //   const uint32_t size;  // sizeof(struct _protocol_t)
   //   const uint32_t flags;  // = 0
   //   const char ** extendedMethodTypes;
+  //   const char *demangledName;
   // }
 
   // Holder for struct _protocol_list_t *
@@ -5276,6 +5277,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
                              MethodListnfABIPtrTy, MethodListnfABIPtrTy,
                              MethodListnfABIPtrTy, MethodListnfABIPtrTy,
                              PropertyListPtrTy, IntTy, IntTy, Int8PtrPtrTy,
+                             Int8PtrTy,
                              nullptr);
 
   // struct _protocol_t*
@@ -6208,6 +6210,7 @@ llvm::Constant *CGObjCNonFragileABIMac::
 ///   const uint32_t size;  // sizeof(struct _protocol_t)
 ///   const uint32_t flags;  // = 0
 ///   const char ** extendedMethodTypes;
+///   const char *demangledName;
 /// }
 /// @endcode
 ///
@@ -6259,7 +6262,7 @@ llvm::Constant *CGObjCNonFragileABIMac::
   MethodTypesExt.insert(MethodTypesExt.end(),
                         OptMethodTypesExt.begin(), OptMethodTypesExt.end());
 
-  llvm::Constant *Values[11];
+  llvm::Constant *Values[12];
   // isa is NULL
   Values[0] = llvm::Constant::getNullValue(ObjCTypes.ObjectPtrTy);
   Values[1] = GetClassName(PD->getObjCRuntimeNameAsString());
@@ -6292,6 +6295,9 @@ llvm::Constant *CGObjCNonFragileABIMac::
   Values[10] = EmitProtocolMethodTypes("\01l_OBJC_$_PROTOCOL_METHOD_TYPES_"
                                        + PD->getObjCRuntimeNameAsString(),
                                        MethodTypesExt, ObjCTypes);
+  // const char *demangledName;
+  Values[11] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy);
+    
   llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ProtocolnfABITy,
                                                    Values);
 

Added: cfe/trunk/test/CodeGenObjC/objc2-protocol-metadata.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc2-protocol-metadata.m?rev=233766&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc2-protocol-metadata.m (added)
+++ cfe/trunk/test/CodeGenObjC/objc2-protocol-metadata.m Tue Mar 31 17:22:40 2015
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -emit-llvm -o - %s | FileCheck %s
+// rdar://20286356
+
+ at protocol P1
+- InstP;
++ ClsP;
+ at end
+
+ at interface INTF <P1>
+ at end
+
+ at implementation INTF
+- InstP { return 0; }
++ ClsP  { return 0; }
+ at end
+
+// CHECK: %struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8**, i8* }





More information about the cfe-commits mailing list