[lld] [lld-macho] Add swift support to ObjC category merger (PR #95124)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 13:59:52 PDT 2024
================
@@ -679,11 +679,16 @@ void ObjcCategoryMerger::parseProtocolListInfo(const ConcatInputSection *isec,
(protocolCount * target->wordSize) +
/*header(count)*/ protocolListHeaderLayout.totalSize +
/*extra null value*/ target->wordSize;
- assert(expectedListSize == ptrListSym->isec()->data.size() &&
+
+ // On Swift, the protocol list does not have the extra (unecessary) null value
+ uint32_t expectedListSizeSwift = expectedListSize - target->wordSize;
+
+ assert((expectedListSize == ptrListSym->isec()->data.size() ||
+ expectedListSizeSwift == ptrListSym->isec()->data.size()) &&
"Protocol list does not match expected size");
// Suppress unsuded var warning
- (void)expectedListSize;
+ (void)expectedListSize, (void)expectedListSizeSwift;
----------------
ellishg wrote:
Instead can we add `[[maybe_unused]]` to the declaration?
https://github.com/llvm/llvm-project/pull/95124
More information about the llvm-commits
mailing list