mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-03 00:47:07 +00:00
Use ArrayRef for contiguous areas in ELF. NFC.
This just simplifies the code a bit. More so in lld. llvm-svn: 265403
This commit is contained in:
parent
27fda4cfaf
commit
109cdd5b5d
@ -112,7 +112,7 @@ public:
|
||||
const Elf_Shdr *section_begin() const;
|
||||
const Elf_Shdr *section_end() const;
|
||||
Elf_Shdr_Range sections() const {
|
||||
return make_range(section_begin(), section_end());
|
||||
return makeArrayRef(section_begin(), section_end());
|
||||
}
|
||||
|
||||
const Elf_Sym *symbol_begin(const Elf_Shdr *Sec) const {
|
||||
@ -131,7 +131,7 @@ public:
|
||||
return symbol_begin(Sec) + Size / sizeof(Elf_Sym);
|
||||
}
|
||||
Elf_Sym_Range symbols(const Elf_Shdr *Sec) const {
|
||||
return make_range(symbol_begin(Sec), symbol_end(Sec));
|
||||
return makeArrayRef(symbol_begin(Sec), symbol_end(Sec));
|
||||
}
|
||||
|
||||
const Elf_Rela *rela_begin(const Elf_Shdr *sec) const {
|
||||
@ -148,7 +148,7 @@ public:
|
||||
}
|
||||
|
||||
Elf_Rela_Range relas(const Elf_Shdr *Sec) const {
|
||||
return make_range(rela_begin(Sec), rela_end(Sec));
|
||||
return makeArrayRef(rela_begin(Sec), rela_end(Sec));
|
||||
}
|
||||
|
||||
const Elf_Rel *rel_begin(const Elf_Shdr *sec) const {
|
||||
@ -165,7 +165,7 @@ public:
|
||||
}
|
||||
|
||||
Elf_Rel_Range rels(const Elf_Shdr *Sec) const {
|
||||
return make_range(rel_begin(Sec), rel_end(Sec));
|
||||
return makeArrayRef(rel_begin(Sec), rel_end(Sec));
|
||||
}
|
||||
|
||||
/// \brief Iterate over program header table.
|
||||
@ -180,7 +180,7 @@ public:
|
||||
}
|
||||
|
||||
const Elf_Phdr_Range program_headers() const {
|
||||
return make_range(program_header_begin(), program_header_end());
|
||||
return makeArrayRef(program_header_begin(), program_header_end());
|
||||
}
|
||||
|
||||
uint64_t getNumSections() const;
|
||||
|
@ -59,12 +59,12 @@ public:
|
||||
typedef Elf_Versym_Impl<ELFType<E, Is64>> Versym;
|
||||
typedef Elf_Hash_Impl<ELFType<E, Is64>> Hash;
|
||||
typedef Elf_GnuHash_Impl<ELFType<E, Is64>> GnuHash;
|
||||
typedef iterator_range<const Dyn *> DynRange;
|
||||
typedef iterator_range<const Shdr *> ShdrRange;
|
||||
typedef iterator_range<const Sym *> SymRange;
|
||||
typedef iterator_range<const Rel *> RelRange;
|
||||
typedef iterator_range<const Rela *> RelaRange;
|
||||
typedef iterator_range<const Phdr *> PhdrRange;
|
||||
typedef ArrayRef<Dyn> DynRange;
|
||||
typedef ArrayRef<Shdr> ShdrRange;
|
||||
typedef ArrayRef<Sym> SymRange;
|
||||
typedef ArrayRef<Rel> RelRange;
|
||||
typedef ArrayRef<Rela> RelaRange;
|
||||
typedef ArrayRef<Phdr> PhdrRange;
|
||||
|
||||
typedef packed<uint16_t> Half;
|
||||
typedef packed<uint32_t> Word;
|
||||
|
@ -82,7 +82,7 @@ struct DynRegionInfo {
|
||||
/// \brief Size of each entity in the region.
|
||||
uint64_t EntSize;
|
||||
|
||||
template <typename Type> iterator_range<const Type *> getAsRange() const {
|
||||
template <typename Type> ArrayRef<Type> getAsArrayRef() const {
|
||||
const Type *Start = reinterpret_cast<const Type *>(Addr);
|
||||
if (!Start)
|
||||
return {Start, Start};
|
||||
@ -215,11 +215,11 @@ private:
|
||||
|
||||
public:
|
||||
Elf_Dyn_Range dynamic_table() const {
|
||||
return DynamicTable.getAsRange<Elf_Dyn>();
|
||||
return DynamicTable.getAsArrayRef<Elf_Dyn>();
|
||||
}
|
||||
|
||||
Elf_Sym_Range dynamic_symbols() const {
|
||||
return DynSymRegion.getAsRange<Elf_Sym>();
|
||||
return DynSymRegion.getAsArrayRef<Elf_Sym>();
|
||||
}
|
||||
|
||||
Elf_Rel_Range dyn_rels() const;
|
||||
@ -1349,12 +1349,12 @@ void ELFDumper<ELFT>::parseDynamicTable(
|
||||
|
||||
template <typename ELFT>
|
||||
typename ELFDumper<ELFT>::Elf_Rel_Range ELFDumper<ELFT>::dyn_rels() const {
|
||||
return DynRelRegion.getAsRange<Elf_Rel>();
|
||||
return DynRelRegion.getAsArrayRef<Elf_Rel>();
|
||||
}
|
||||
|
||||
template <typename ELFT>
|
||||
typename ELFDumper<ELFT>::Elf_Rela_Range ELFDumper<ELFT>::dyn_relas() const {
|
||||
return DynRelaRegion.getAsRange<Elf_Rela>();
|
||||
return DynRelaRegion.getAsArrayRef<Elf_Rela>();
|
||||
}
|
||||
|
||||
template<class ELFT>
|
||||
@ -2906,11 +2906,11 @@ void GNUStyle<ELFT>::printDynamicRelocations(const ELFO *Obj) {
|
||||
}
|
||||
if (DynPLTRelRegion.EntSize == sizeof(Elf_Rela)) {
|
||||
printRelocHeader(OS, ELFT::Is64Bits, true);
|
||||
for (const Elf_Rela &Rela : DynPLTRelRegion.getAsRange<Elf_Rela>())
|
||||
for (const Elf_Rela &Rela : DynPLTRelRegion.getAsArrayRef<Elf_Rela>())
|
||||
printDynamicRelocation(Obj, Rela, true);
|
||||
} else {
|
||||
printRelocHeader(OS, ELFT::Is64Bits, false);
|
||||
for (const Elf_Rel &Rel : DynPLTRelRegion.getAsRange<Elf_Rel>()) {
|
||||
for (const Elf_Rel &Rel : DynPLTRelRegion.getAsArrayRef<Elf_Rel>()) {
|
||||
Elf_Rela Rela;
|
||||
Rela.r_offset = Rel.r_offset;
|
||||
Rela.r_info = Rel.r_info;
|
||||
@ -3226,10 +3226,10 @@ void LLVMStyle<ELFT>::printDynamicRelocations(const ELFO *Obj) {
|
||||
printDynamicRelocation(Obj, Rela);
|
||||
}
|
||||
if (DynPLTRelRegion.EntSize == sizeof(Elf_Rela))
|
||||
for (const Elf_Rela &Rela : DynPLTRelRegion.getAsRange<Elf_Rela>())
|
||||
for (const Elf_Rela &Rela : DynPLTRelRegion.getAsArrayRef<Elf_Rela>())
|
||||
printDynamicRelocation(Obj, Rela);
|
||||
else
|
||||
for (const Elf_Rel &Rel : DynPLTRelRegion.getAsRange<Elf_Rel>()) {
|
||||
for (const Elf_Rel &Rel : DynPLTRelRegion.getAsArrayRef<Elf_Rel>()) {
|
||||
Elf_Rela Rela;
|
||||
Rela.r_offset = Rel.r_offset;
|
||||
Rela.r_info = Rel.r_info;
|
||||
|
Loading…
Reference in New Issue
Block a user