[lld] [lld-macho][ObjC] Implement category merging into base class (PR #92448)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 06:46:55 PDT 2024


================
@@ -379,12 +379,21 @@ class ObjcCategoryMerger {
     InfoWriteSection catPtrListInfo;
   };
 
-  // Information about a pointer list in the original categories (method lists,
-  // protocol lists, etc)
+  // Information about a pointer list in the original categories or class(method
+  // lists, protocol lists, etc)
   struct PointerListInfo {
+    PointerListInfo() = default;
+    PointerListInfo(const PointerListInfo &) = default;
     PointerListInfo(const char *_categoryPrefix, uint32_t _pointersPerStruct)
         : categoryPrefix(_categoryPrefix),
           pointersPerStruct(_pointersPerStruct) {}
+
+    inline bool operator==(const PointerListInfo &cmp) {
----------------
alx32 wrote:

`categoryPrefix` shouldn't matter either way. Yes, operator overloading seems necessary but not sure how else to easily achieve the result. I guess we could do something like `parseProtocolListInfo(a).structSize == parseProtocolListInfo(b).structSize && parseProtocolListInfo(a). ...`, which would mean calling `parseProtocolListInfo` for each field which looks worse than the current approach. 

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


More information about the llvm-commits mailing list