Skip to content

Commit 4ea30b4

Browse files
author
Alex B
committed
[lld-macho] Address Feedback #4
1 parent a4b74c0 commit 4ea30b4

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

lld/MachO/ObjC.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,9 @@ ObjcCategoryMerger::emitCatListEntrySec(const std::string &forCateogryName,
903903
return catListSym;
904904
}
905905

906-
// Here we generate the main category body and just the body and link the name
907-
// and base class into it. We don't link any other info like the protocol and
908-
// class/instance methods/props.
906+
// Here we generate the main category body and link the name and base class into
907+
// it. We don't link any other info yet like the protocol and class/instance
908+
// methods/props.
909909
Defined *ObjcCategoryMerger::emitCategoryBody(const std::string &name,
910910
const Defined *nameSym,
911911
const Symbol *baseClassSym,
@@ -1062,8 +1062,10 @@ void ObjcCategoryMerger::collectAndValidateCategoriesData() {
10621062
Defined *categorySym = tryGetDefinedAtIsecOffset(catListCisec, off);
10631063
assert(categorySym &&
10641064
"Failed to get a valid cateogry at __objc_catlit offset");
1065+
1066+
// We only support ObjC categories (no swift + @objc)
10651067
if (!categorySym->getName().starts_with(objc::symbol_names::category))
1066-
continue; // Only support ObjC categories (no swift + @objc)
1068+
continue;
10671069

10681070
auto *catBodyIsec = dyn_cast<ConcatInputSection>(categorySym->isec);
10691071
assert(catBodyIsec &&
@@ -1082,18 +1084,6 @@ void ObjcCategoryMerger::collectAndValidateCategoriesData() {
10821084
collectCategoryWriterInfoFromCategory(catInputInfo);
10831085
}
10841086
}
1085-
1086-
for (auto &entry : categoryMap)
1087-
if (entry.second.size() > 1) {
1088-
// Sort categories by offset to make sure we process categories in
1089-
// the same order as they appear in the input
1090-
auto cmpFn = [](const InfoInputCategory &a, const InfoInputCategory &b) {
1091-
return (a.catListIsec == b.catListIsec) &&
1092-
(a.offCatListIsec < b.offCatListIsec);
1093-
};
1094-
1095-
llvm::sort(entry.second, cmpFn);
1096-
}
10971087
}
10981088

10991089
// In the input we have multiple __objc_catlist InputSection, each of which may

0 commit comments

Comments
 (0)