mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Object: Make SymbolicFile::symbol_{begin,end}() virtual and remove unnecessary wrappers.
llvm-svn: 287611
This commit is contained in:
parent
d65f1f5cc9
commit
b2fc05a60b
@ -746,8 +746,8 @@ protected:
|
||||
|
||||
public:
|
||||
COFFObjectFile(MemoryBufferRef Object, std::error_code &EC);
|
||||
basic_symbol_iterator symbol_begin_impl() const override;
|
||||
basic_symbol_iterator symbol_end_impl() const override;
|
||||
basic_symbol_iterator symbol_begin() const override;
|
||||
basic_symbol_iterator symbol_end() const override;
|
||||
section_iterator section_begin() const override;
|
||||
section_iterator section_end() const override;
|
||||
|
||||
|
@ -47,11 +47,11 @@ public:
|
||||
return SymbolRef::SF_Global;
|
||||
}
|
||||
|
||||
basic_symbol_iterator symbol_begin_impl() const override {
|
||||
basic_symbol_iterator symbol_begin() const override {
|
||||
return BasicSymbolRef(DataRefImpl(), this);
|
||||
}
|
||||
|
||||
basic_symbol_iterator symbol_end_impl() const override {
|
||||
basic_symbol_iterator symbol_end() const override {
|
||||
DataRefImpl Symb;
|
||||
Symb.p = isCode() ? 2 : 1;
|
||||
return BasicSymbolRef(Symb, this);
|
||||
|
@ -336,8 +336,8 @@ public:
|
||||
return reinterpret_cast<const Elf_Shdr *>(Sec.p);
|
||||
}
|
||||
|
||||
basic_symbol_iterator symbol_begin_impl() const override;
|
||||
basic_symbol_iterator symbol_end_impl() const override;
|
||||
basic_symbol_iterator symbol_begin() const override;
|
||||
basic_symbol_iterator symbol_end() const override;
|
||||
|
||||
elf_symbol_iterator dynamic_symbol_begin() const;
|
||||
elf_symbol_iterator dynamic_symbol_end() const;
|
||||
@ -843,16 +843,16 @@ ELFObjectFile<ELFT>::ELFObjectFile(MemoryBufferRef Object, std::error_code &EC)
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
basic_symbol_iterator ELFObjectFile<ELFT>::symbol_begin_impl() const {
|
||||
basic_symbol_iterator ELFObjectFile<ELFT>::symbol_begin() const {
|
||||
DataRefImpl Sym = toDRI(DotSymtabSec, 0);
|
||||
return basic_symbol_iterator(SymbolRef(Sym, this));
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
basic_symbol_iterator ELFObjectFile<ELFT>::symbol_end_impl() const {
|
||||
basic_symbol_iterator ELFObjectFile<ELFT>::symbol_end() const {
|
||||
const Elf_Shdr *SymTab = DotSymtabSec;
|
||||
if (!SymTab)
|
||||
return symbol_begin_impl();
|
||||
return symbol_begin();
|
||||
DataRefImpl Sym = toDRI(SymTab, SymTab->sh_size / sizeof(Elf_Sym));
|
||||
return basic_symbol_iterator(SymbolRef(Sym, this));
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ public:
|
||||
const GlobalValue *getSymbolGV(DataRefImpl Symb) const {
|
||||
return const_cast<IRObjectFile *>(this)->getSymbolGV(Symb);
|
||||
}
|
||||
basic_symbol_iterator symbol_begin_impl() const override;
|
||||
basic_symbol_iterator symbol_end_impl() const override;
|
||||
basic_symbol_iterator symbol_begin() const override;
|
||||
basic_symbol_iterator symbol_end() const override;
|
||||
|
||||
const Module &getModule() const {
|
||||
return const_cast<IRObjectFile*>(this)->getModule();
|
||||
|
@ -251,8 +251,8 @@ public:
|
||||
// TODO: Would be useful to have an iterator based version
|
||||
// of the load command interface too.
|
||||
|
||||
basic_symbol_iterator symbol_begin_impl() const override;
|
||||
basic_symbol_iterator symbol_end_impl() const override;
|
||||
basic_symbol_iterator symbol_begin() const override;
|
||||
basic_symbol_iterator symbol_end() const override;
|
||||
|
||||
// MachO specific.
|
||||
basic_symbol_iterator getSymbolByIndex(unsigned Index) const;
|
||||
|
@ -50,11 +50,11 @@ public:
|
||||
llvm_unreachable("not implemented");
|
||||
return 0;
|
||||
}
|
||||
basic_symbol_iterator symbol_begin_impl() const override {
|
||||
basic_symbol_iterator symbol_begin() const override {
|
||||
llvm_unreachable("not implemented");
|
||||
return basic_symbol_iterator(BasicSymbolRef());
|
||||
}
|
||||
basic_symbol_iterator symbol_end_impl() const override {
|
||||
basic_symbol_iterator symbol_end() const override {
|
||||
llvm_unreachable("not implemented");
|
||||
return basic_symbol_iterator(BasicSymbolRef());
|
||||
}
|
||||
|
@ -137,17 +137,11 @@ public:
|
||||
|
||||
virtual uint32_t getSymbolFlags(DataRefImpl Symb) const = 0;
|
||||
|
||||
virtual basic_symbol_iterator symbol_begin_impl() const = 0;
|
||||
virtual basic_symbol_iterator symbol_begin() const = 0;
|
||||
|
||||
virtual basic_symbol_iterator symbol_end_impl() const = 0;
|
||||
virtual basic_symbol_iterator symbol_end() const = 0;
|
||||
|
||||
// convenience wrappers.
|
||||
basic_symbol_iterator symbol_begin() const {
|
||||
return symbol_begin_impl();
|
||||
}
|
||||
basic_symbol_iterator symbol_end() const {
|
||||
return symbol_end_impl();
|
||||
}
|
||||
typedef iterator_range<basic_symbol_iterator> basic_symbol_iterator_range;
|
||||
basic_symbol_iterator_range symbols() const {
|
||||
return basic_symbol_iterator_range(symbol_begin(), symbol_end());
|
||||
|
@ -771,13 +771,13 @@ COFFObjectFile::COFFObjectFile(MemoryBufferRef Object, std::error_code &EC)
|
||||
EC = std::error_code();
|
||||
}
|
||||
|
||||
basic_symbol_iterator COFFObjectFile::symbol_begin_impl() const {
|
||||
basic_symbol_iterator COFFObjectFile::symbol_begin() const {
|
||||
DataRefImpl Ret;
|
||||
Ret.p = getSymbolTable();
|
||||
return basic_symbol_iterator(SymbolRef(Ret, this));
|
||||
}
|
||||
|
||||
basic_symbol_iterator COFFObjectFile::symbol_end_impl() const {
|
||||
basic_symbol_iterator COFFObjectFile::symbol_end() const {
|
||||
// The symbol table ends where the string table begins.
|
||||
DataRefImpl Ret;
|
||||
Ret.p = reinterpret_cast<uintptr_t>(StringTable);
|
||||
|
@ -262,14 +262,14 @@ GlobalValue *IRObjectFile::getSymbolGV(DataRefImpl Symb) { return getGV(Symb); }
|
||||
|
||||
std::unique_ptr<Module> IRObjectFile::takeModule() { return std::move(M); }
|
||||
|
||||
basic_symbol_iterator IRObjectFile::symbol_begin_impl() const {
|
||||
basic_symbol_iterator IRObjectFile::symbol_begin() const {
|
||||
Module::const_iterator I = M->begin();
|
||||
DataRefImpl Ret;
|
||||
Ret.p = skipEmpty(I, *M);
|
||||
return basic_symbol_iterator(BasicSymbolRef(Ret, this));
|
||||
}
|
||||
|
||||
basic_symbol_iterator IRObjectFile::symbol_end_impl() const {
|
||||
basic_symbol_iterator IRObjectFile::symbol_end() const {
|
||||
DataRefImpl Ret;
|
||||
uint64_t NumAsm = AsmSymbols.size();
|
||||
NumAsm <<= 2;
|
||||
|
@ -2209,7 +2209,7 @@ MachOObjectFile::getRelocationRelocatedSection(relocation_iterator Rel) const {
|
||||
return section_iterator(SectionRef(Sec, this));
|
||||
}
|
||||
|
||||
basic_symbol_iterator MachOObjectFile::symbol_begin_impl() const {
|
||||
basic_symbol_iterator MachOObjectFile::symbol_begin() const {
|
||||
DataRefImpl DRI;
|
||||
MachO::symtab_command Symtab = getSymtabLoadCommand();
|
||||
if (!SymtabLoadCmd || Symtab.nsyms == 0)
|
||||
@ -2218,7 +2218,7 @@ basic_symbol_iterator MachOObjectFile::symbol_begin_impl() const {
|
||||
return getSymbolByIndex(0);
|
||||
}
|
||||
|
||||
basic_symbol_iterator MachOObjectFile::symbol_end_impl() const {
|
||||
basic_symbol_iterator MachOObjectFile::symbol_end() const {
|
||||
DataRefImpl DRI;
|
||||
MachO::symtab_command Symtab = getSymtabLoadCommand();
|
||||
if (!SymtabLoadCmd || Symtab.nsyms == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user