[clang] [clang][CGObjCMac] Unionize identical llvm types (NFC) (PR #110422)
Youngsuk Kim via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 29 05:01:38 PDT 2024
https://github.com/JOE1994 created https://github.com/llvm/llvm-project/pull/110422
Unionize llvm types which became identical since LLVM opted to use opaque pointers by default.
>From f23d6c73cd620ac21d40846c1be0fb66606e9e17 Mon Sep 17 00:00:00 2001
From: Youngsuk Kim <youngsuk.kim at hpe.com>
Date: Sun, 29 Sep 2024 06:42:25 -0500
Subject: [PATCH] [clang][CGObjCMac] Unionize identical llvm types (NFC)
Unionize llvm types which became identical since LLVM opted to use opaque
pointers by default.
---
clang/lib/CodeGen/CGObjCMac.cpp | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 30f3911a8b03c2..ed2aab0dceb077 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -173,16 +173,18 @@ class ObjCCommonTypesHelper {
public:
llvm::IntegerType *ShortTy, *IntTy, *LongTy;
- llvm::PointerType *Int8PtrTy, *Int8PtrPtrTy;
+
+ union {
+ llvm::PointerType *Int8PtrTy;
+ llvm::PointerType *Int8PtrPtrTy;
+ };
+
llvm::PointerType *Int8PtrProgramASTy;
llvm::Type *IvarOffsetVarTy;
/// ObjectPtrTy - LLVM type for object handles (typeof(id))
llvm::PointerType *ObjectPtrTy;
- /// PtrObjectPtrTy - LLVM type for id *
- llvm::PointerType *PtrObjectPtrTy;
-
/// SelectorPtrTy - LLVM type for selector handles (typeof(SEL))
llvm::PointerType *SelectorPtrTy;
@@ -212,8 +214,6 @@ class ObjCCommonTypesHelper {
/// SuperTy - LLVM type for struct objc_super.
llvm::StructType *SuperTy;
- /// SuperPtrTy - LLVM type for struct objc_super *.
- llvm::PointerType *SuperPtrTy;
/// PropertyTy - LLVM type for struct objc_property (struct _prop_t
/// in GCC parlance).
@@ -222,16 +222,23 @@ class ObjCCommonTypesHelper {
/// PropertyListTy - LLVM type for struct objc_property_list
/// (_prop_list_t in GCC parlance).
llvm::StructType *PropertyListTy;
- /// PropertyListPtrTy - LLVM type for struct objc_property_list*.
- llvm::PointerType *PropertyListPtrTy;
// MethodTy - LLVM type for struct objc_method.
llvm::StructType *MethodTy;
/// CacheTy - LLVM type for struct objc_cache.
llvm::Type *CacheTy;
- /// CachePtrTy - LLVM type for struct objc_cache *.
- llvm::PointerType *CachePtrTy;
+
+ union {
+ /// PtrObjectPtrTy - LLVM type for id *
+ llvm::PointerType *PtrObjectPtrTy;
+ /// SuperPtrTy - LLVM type for struct objc_super *.
+ llvm::PointerType *SuperPtrTy;
+ /// PropertyListPtrTy - LLVM type for struct objc_property_list*.
+ llvm::PointerType *PropertyListPtrTy;
+ /// CachePtrTy - LLVM type for struct objc_cache *.
+ llvm::PointerType *CachePtrTy;
+ };
llvm::FunctionCallee getGetPropertyFn() {
CodeGen::CodeGenTypes &Types = CGM.getTypes();
More information about the cfe-commits
mailing list