Skip to content

Commit 0d30017

Browse files
committed
Replace Symbol with Defined
1 parent 123c8a7 commit 0d30017

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

lld/ELF/BPSectionOrderer.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ struct BPOrdererELF;
2222
}
2323
template <> struct lld::BPOrdererTraits<struct BPOrdererELF> {
2424
using Section = elf::InputSectionBase;
25-
using Symbol = elf::Symbol;
25+
using Defined = elf::Defined;
2626
};
2727
namespace {
2828
struct BPOrdererELF : lld::BPOrderer<BPOrdererELF> {
2929
static uint64_t getSize(const Section &sec) { return sec.getSize(); }
3030
static bool isCodeSection(const Section &sec) {
3131
return sec.flags & llvm::ELF::SHF_EXECINSTR;
3232
}
33-
static SmallVector<Symbol *, 0> getSymbols(const Section &sec) {
34-
SmallVector<Symbol *, 0> symbols;
33+
static SmallVector<Defined *, 0> getSymbols(const Section &sec) {
34+
SmallVector<Defined *, 0> symbols;
3535
for (auto *sym : sec.file->getSymbols())
3636
if (auto *d = llvm::dyn_cast_or_null<Defined>(sym))
3737
if (d->size > 0 && d->section == &sec)
@@ -56,17 +56,9 @@ struct BPOrdererELF : lld::BPOrderer<BPOrdererELF> {
5656
hashes.erase(std::unique(hashes.begin(), hashes.end()), hashes.end());
5757
}
5858

59-
static llvm::StringRef getSymName(const Symbol &sym) { return sym.getName(); }
60-
static uint64_t getSymValue(const Symbol &sym) {
61-
if (auto *d = dyn_cast<Defined>(&sym))
62-
return d->value;
63-
return 0;
64-
}
65-
static uint64_t getSymSize(const Symbol &sym) {
66-
if (auto *d = dyn_cast<Defined>(&sym))
67-
return d->size;
68-
return 0;
69-
}
59+
static StringRef getSymName(const Defined &sym) { return sym.getName(); }
60+
static uint64_t getSymValue(const Defined &sym) { return sym.value; }
61+
static uint64_t getSymSize(const Defined &sym) { return sym.size; }
7062
};
7163
} // namespace
7264

0 commit comments

Comments
 (0)