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

via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 11:32:20 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:

> Checking size only but not other pointer contents is okay

`allPtrs == cmp.allPtrs` on line `394` compares the pointer list contents - i.e. that the symbols in the array are identical (as pointer values) and are in the same order. 

> seems unnatural to define an equality while only considering the part of contents.

I am not sure what you mean here, do you mean comparing the symbols by pointer values is not OK ? Because this should be OK as the symbols are unique pointers.

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


More information about the llvm-commits mailing list