@@ -191,8 +191,8 @@ static StringRef getReferentString(const Reloc &r) {
191
191
if (auto *isec = r.referent .dyn_cast <InputSection *>())
192
192
return cast<CStringInputSection>(isec)->getStringRefAtOffset (r.addend );
193
193
auto *sym = cast<Defined>(r.referent .get <Symbol *>());
194
- return cast<CStringInputSection>(sym->isec )-> getStringRefAtOffset (sym-> value +
195
- r.addend );
194
+ return cast<CStringInputSection>(sym->isec ())
195
+ -> getStringRefAtOffset (sym-> value + r.addend );
196
196
}
197
197
198
198
void ObjcCategoryChecker::parseMethods (const ConcatInputSection *methodsIsec,
@@ -306,15 +306,15 @@ void ObjcCategoryChecker::parseClass(const Defined *classSym) {
306
306
return nullptr ;
307
307
};
308
308
309
- const auto *classIsec = cast<ConcatInputSection>(classSym->isec );
309
+ const auto *classIsec = cast<ConcatInputSection>(classSym->isec () );
310
310
311
311
// Parse instance methods.
312
312
if (const auto *instanceMethodsIsec = getMethodsIsec (classIsec))
313
313
parseMethods (instanceMethodsIsec, classSym, classIsec, MCK_Class,
314
314
MK_Instance);
315
315
316
316
// Class methods are contained in the metaclass.
317
- if (const auto *r = classSym->isec ->getRelocAt (classLayout.metaClassOffset ))
317
+ if (const auto *r = classSym->isec () ->getRelocAt (classLayout.metaClassOffset ))
318
318
if (const auto *classMethodsIsec = getMethodsIsec (
319
319
cast<ConcatInputSection>(r->getReferentInputSection ())))
320
320
parseMethods (classMethodsIsec, classSym, classIsec, MCK_Class, MK_Static);
@@ -561,9 +561,9 @@ void ObjcCategoryMerger::tryEraseDefinedAtIsecOffset(
561
561
if (!sym)
562
562
return ;
563
563
564
- if (auto *cisec = dyn_cast_or_null<ConcatInputSection>(sym->isec ))
564
+ if (auto *cisec = dyn_cast_or_null<ConcatInputSection>(sym->isec () ))
565
565
eraseISec (cisec);
566
- else if (auto *csisec = dyn_cast_or_null<CStringInputSection>(sym->isec )) {
566
+ else if (auto *csisec = dyn_cast_or_null<CStringInputSection>(sym->isec () )) {
567
567
uint32_t totalOffset = sym->value + reloc->addend ;
568
568
StringPiece &piece = csisec->getStringPiece (totalOffset);
569
569
piece.live = false ;
@@ -588,7 +588,7 @@ void ObjcCategoryMerger::collectCategoryWriterInfoFromCategory(
588
588
assert (catNameSym && " Category does not have a valid name Symbol" );
589
589
590
590
collectSectionWriteInfoFromIsec<CStringSection>(
591
- catNameSym->isec , infoCategoryWriter.catNameInfo );
591
+ catNameSym->isec () , infoCategoryWriter.catNameInfo );
592
592
}
593
593
594
594
// Collect writer info from all the category lists (we're assuming they all
@@ -599,7 +599,7 @@ void ObjcCategoryMerger::collectCategoryWriterInfoFromCategory(
599
599
if (Defined *ptrList =
600
600
tryGetDefinedAtIsecOffset (catInfo.catBodyIsec , off)) {
601
601
collectSectionWriteInfoFromIsec<ConcatOutputSection>(
602
- ptrList->isec , infoCategoryWriter.catPtrListInfo );
602
+ ptrList->isec () , infoCategoryWriter.catPtrListInfo );
603
603
// we've successfully collected data, so we can break
604
604
break ;
605
605
}
@@ -627,7 +627,7 @@ void ObjcCategoryMerger::parseProtocolListInfo(const ConcatInputSection *isec,
627
627
// platform pointer size, but to simplify implementation we always just read
628
628
// the lower 32b which should be good enough.
629
629
uint32_t protocolCount = *reinterpret_cast <const uint32_t *>(
630
- ptrListSym->isec ->data .data () + listHeaderLayout.structSizeOffset );
630
+ ptrListSym->isec () ->data .data () + listHeaderLayout.structSizeOffset );
631
631
632
632
ptrList.structCount += protocolCount;
633
633
ptrList.structSize = target->wordSize ;
@@ -636,15 +636,15 @@ void ObjcCategoryMerger::parseProtocolListInfo(const ConcatInputSection *isec,
636
636
(protocolCount * target->wordSize ) +
637
637
/* header(count)*/ protocolListHeaderLayout.totalSize +
638
638
/* extra null value*/ target->wordSize ;
639
- assert (expectedListSize == ptrListSym->isec ->data .size () &&
639
+ assert (expectedListSize == ptrListSym->isec () ->data .size () &&
640
640
" Protocol list does not match expected size" );
641
641
642
642
// Suppress unsuded var warning
643
643
(void )expectedListSize;
644
644
645
645
uint32_t off = protocolListHeaderLayout.totalSize ;
646
646
for (uint32_t inx = 0 ; inx < protocolCount; ++inx) {
647
- const Reloc *reloc = ptrListSym->isec ->getRelocAt (off);
647
+ const Reloc *reloc = ptrListSym->isec () ->getRelocAt (off);
648
648
assert (reloc && " No reloc found at protocol list offset" );
649
649
650
650
auto *listSym = dyn_cast_or_null<Defined>(reloc->referent .get <Symbol *>());
@@ -653,7 +653,7 @@ void ObjcCategoryMerger::parseProtocolListInfo(const ConcatInputSection *isec,
653
653
ptrList.allPtrs .push_back (listSym);
654
654
off += target->wordSize ;
655
655
}
656
- assert ((ptrListSym->isec ->getRelocAt (off) == nullptr ) &&
656
+ assert ((ptrListSym->isec () ->getRelocAt (off) == nullptr ) &&
657
657
" expected null terminating protocol" );
658
658
assert (off + /* extra null value*/ target->wordSize == expectedListSize &&
659
659
" Protocol list end offset does not match expected size" );
@@ -678,9 +678,9 @@ void ObjcCategoryMerger::parsePointerListInfo(const ConcatInputSection *isec,
678
678
assert (ptrListSym && " Reloc does not have a valid Defined" );
679
679
680
680
uint32_t thisStructSize = *reinterpret_cast <const uint32_t *>(
681
- ptrListSym->isec ->data .data () + listHeaderLayout.structSizeOffset );
681
+ ptrListSym->isec () ->data .data () + listHeaderLayout.structSizeOffset );
682
682
uint32_t thisStructCount = *reinterpret_cast <const uint32_t *>(
683
- ptrListSym->isec ->data .data () + listHeaderLayout.structCountOffset );
683
+ ptrListSym->isec () ->data .data () + listHeaderLayout.structCountOffset );
684
684
assert (thisStructSize == ptrList.pointersPerStruct * target->wordSize );
685
685
686
686
assert (!ptrList.structSize || (thisStructSize == ptrList.structSize ));
@@ -690,12 +690,12 @@ void ObjcCategoryMerger::parsePointerListInfo(const ConcatInputSection *isec,
690
690
691
691
uint32_t expectedListSize =
692
692
listHeaderLayout.totalSize + (thisStructSize * thisStructCount);
693
- assert (expectedListSize == ptrListSym->isec ->data .size () &&
693
+ assert (expectedListSize == ptrListSym->isec () ->data .size () &&
694
694
" Pointer list does not match expected size" );
695
695
696
696
for (uint32_t off = listHeaderLayout.totalSize ; off < expectedListSize;
697
697
off += target->wordSize ) {
698
- const Reloc *reloc = ptrListSym->isec ->getRelocAt (off);
698
+ const Reloc *reloc = ptrListSym->isec () ->getRelocAt (off);
699
699
assert (reloc && " No reloc found at pointer list offset" );
700
700
701
701
auto *listSym = dyn_cast_or_null<Defined>(reloc->referent .get <Symbol *>());
@@ -1054,7 +1054,7 @@ void ObjcCategoryMerger::createSymbolReference(Defined *refFrom,
1054
1054
r.offset = offset;
1055
1055
r.addend = 0 ;
1056
1056
r.referent = const_cast <Symbol *>(refTo);
1057
- refFrom->isec ->relocs .push_back (r);
1057
+ refFrom->isec () ->relocs .push_back (r);
1058
1058
}
1059
1059
1060
1060
void ObjcCategoryMerger::collectAndValidateCategoriesData () {
@@ -1076,7 +1076,7 @@ void ObjcCategoryMerger::collectAndValidateCategoriesData() {
1076
1076
if (!categorySym->getName ().starts_with (objc::symbol_names::category))
1077
1077
continue ;
1078
1078
1079
- auto *catBodyIsec = dyn_cast<ConcatInputSection>(categorySym->isec );
1079
+ auto *catBodyIsec = dyn_cast<ConcatInputSection>(categorySym->isec () );
1080
1080
assert (catBodyIsec &&
1081
1081
" Category data section is not an ConcatInputSection" );
1082
1082
0 commit comments