[lld] e8e75e0 - [lld-macho] Remove unneeded functions from BPSectionOrderer. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 26 09:47:40 PST 2025
Author: Fangrui Song
Date: 2025-01-26T09:46:38-08:00
New Revision: e8e75e08c9214fe25b56535fc26f5435a875a137
URL: https://github.com/llvm/llvm-project/commit/e8e75e08c9214fe25b56535fc26f5435a875a137
DIFF: https://github.com/llvm/llvm-project/commit/e8e75e08c9214fe25b56535fc26f5435a875a137.diff
LOG: [lld-macho] Remove unneeded functions from BPSectionOrderer. NFC
Added:
Modified:
lld/MachO/BPSectionOrderer.cpp
lld/MachO/BPSectionOrderer.h
Removed:
################################################################################
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 18c8aad58344f2..c2d03c968534e4 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -26,8 +26,7 @@ DenseMap<const InputSection *, int> lld::macho::runBalancedPartitioning(
auto *isec = subsec.isec;
if (!isec || isec->data.empty() || !isec->data.data())
continue;
- sections.emplace_back(
- std::make_unique<BPSectionMacho>(isec, sections.size()));
+ sections.emplace_back(std::make_unique<BPSectionMacho>(isec));
}
}
}
@@ -38,11 +37,10 @@ DenseMap<const InputSection *, int> lld::macho::runBalancedPartitioning(
DenseMap<const InputSection *, int> result;
for (const auto &[sec, priority] : reorderedSections) {
- if (auto *machoSection = dyn_cast<BPSectionMacho>(sec)) {
- result.try_emplace(
- static_cast<const InputSection *>(machoSection->getSection()),
- priority);
- }
+ result.try_emplace(
+ static_cast<const InputSection *>(
+ static_cast<const BPSectionMacho *>(sec)->getSection()),
+ priority);
}
return result;
}
diff --git a/lld/MachO/BPSectionOrderer.h b/lld/MachO/BPSectionOrderer.h
index 69c6b260f044cb..e3e6b12092e204 100644
--- a/lld/MachO/BPSectionOrderer.h
+++ b/lld/MachO/BPSectionOrderer.h
@@ -57,18 +57,14 @@ class BPSymbolMacho : public BPSymbol {
class BPSectionMacho : public BPSectionBase {
const InputSection *isec;
- uint64_t sectionIdx;
public:
- explicit BPSectionMacho(const InputSection *sec, uint64_t sectionIdx)
- : isec(sec), sectionIdx(sectionIdx) {}
+ explicit BPSectionMacho(const InputSection *sec) : isec(sec) {}
const void *getSection() const override { return isec; }
uint64_t getSize() const override { return isec->getSize(); }
- uint64_t getSectionIdx() const { return sectionIdx; }
-
bool isCodeSection() const override { return macho::isCodeSection(isec); }
SmallVector<std::unique_ptr<BPSymbol>> getSymbols() const override {
@@ -118,8 +114,6 @@ class BPSectionMacho : public BPSectionBase {
hashes.erase(std::unique(hashes.begin(), hashes.end()), hashes.end());
}
- static bool classof(const BPSectionBase *s) { return true; }
-
private:
static uint64_t
getRelocHash(const Reloc &reloc,
More information about the llvm-commits
mailing list