Skip to content

Commit e8e75e0

Browse files
committed
[lld-macho] Remove unneeded functions from BPSectionOrderer. NFC
1 parent f8ab91f commit e8e75e0

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

lld/MachO/BPSectionOrderer.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ DenseMap<const InputSection *, int> lld::macho::runBalancedPartitioning(
2626
auto *isec = subsec.isec;
2727
if (!isec || isec->data.empty() || !isec->data.data())
2828
continue;
29-
sections.emplace_back(
30-
std::make_unique<BPSectionMacho>(isec, sections.size()));
29+
sections.emplace_back(std::make_unique<BPSectionMacho>(isec));
3130
}
3231
}
3332
}
@@ -38,11 +37,10 @@ DenseMap<const InputSection *, int> lld::macho::runBalancedPartitioning(
3837

3938
DenseMap<const InputSection *, int> result;
4039
for (const auto &[sec, priority] : reorderedSections) {
41-
if (auto *machoSection = dyn_cast<BPSectionMacho>(sec)) {
42-
result.try_emplace(
43-
static_cast<const InputSection *>(machoSection->getSection()),
44-
priority);
45-
}
40+
result.try_emplace(
41+
static_cast<const InputSection *>(
42+
static_cast<const BPSectionMacho *>(sec)->getSection()),
43+
priority);
4644
}
4745
return result;
4846
}

lld/MachO/BPSectionOrderer.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,14 @@ class BPSymbolMacho : public BPSymbol {
5757

5858
class BPSectionMacho : public BPSectionBase {
5959
const InputSection *isec;
60-
uint64_t sectionIdx;
6160

6261
public:
63-
explicit BPSectionMacho(const InputSection *sec, uint64_t sectionIdx)
64-
: isec(sec), sectionIdx(sectionIdx) {}
62+
explicit BPSectionMacho(const InputSection *sec) : isec(sec) {}
6563

6664
const void *getSection() const override { return isec; }
6765

6866
uint64_t getSize() const override { return isec->getSize(); }
6967

70-
uint64_t getSectionIdx() const { return sectionIdx; }
71-
7268
bool isCodeSection() const override { return macho::isCodeSection(isec); }
7369

7470
SmallVector<std::unique_ptr<BPSymbol>> getSymbols() const override {
@@ -118,8 +114,6 @@ class BPSectionMacho : public BPSectionBase {
118114
hashes.erase(std::unique(hashes.begin(), hashes.end()), hashes.end());
119115
}
120116

121-
static bool classof(const BPSectionBase *s) { return true; }
122-
123117
private:
124118
static uint64_t
125119
getRelocHash(const Reloc &reloc,

0 commit comments

Comments
 (0)