[clang] [ObjC] Add reserved field in 64-bit ABI mode (PR #85487)

via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 15 17:03:22 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: AtariDreams (AtariDreams)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/85487.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGObjCMac.cpp (+11-5) 


``````````diff
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index e815e097e1fb48..9f59a3a371ac33 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -6047,11 +6047,17 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
   //   const struct _prop_list_t * const properties;
   // }
 
-  // FIXME. Add 'reserved' field in 64bit abi mode!
-  ClassRonfABITy = llvm::StructType::create(
-      "struct._class_ro_t", IntTy, IntTy, IntTy, Int8PtrTy, Int8PtrTy,
-      MethodListnfABIPtrTy, ProtocolListnfABIPtrTy, IvarListnfABIPtrTy,
-      Int8PtrTy, PropertyListPtrTy);
+  if (CGM.getTarget().getTriple().isArch64Bit())
+    ClassRonfABITy = llvm::StructType::create(
+        // Extra reserved field in 64-bit ABI
+        "struct._class_ro_t", IntTy, IntTy, IntTy, IntTy, Int8PtrTy, Int8PtrTy,
+        MethodListnfABIPtrTy, ProtocolListnfABIPtrTy, IvarListnfABIPtrTy,
+        Int8PtrTy, PropertyListPtrTy);
+  else
+    ClassRonfABITy = llvm::StructType::create(
+        "struct._class_ro_t", IntTy, IntTy, IntTy, Int8PtrTy, Int8PtrTy,
+        MethodListnfABIPtrTy, ProtocolListnfABIPtrTy, IvarListnfABIPtrTy,
+        Int8PtrTy, PropertyListPtrTy);
 
   // ImpnfABITy - LLVM for id (*)(id, SEL, ...)
   llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };

``````````

</details>


https://github.com/llvm/llvm-project/pull/85487


More information about the cfe-commits mailing list