// and addend or not.
virtual bool hasRelocationAddend(DataRefImpl Rel) const = 0;
- virtual std::pair<symbol_iterator, symbol_iterator>
- getELFDynamicSymbolIterators() const = 0;
+ virtual symbol_iterator_range getDynamicSymbolIterators() const = 0;
virtual uint64_t getSectionFlags(SectionRef Sec) const = 0;
virtual uint32_t getSectionType(SectionRef Sec) const = 0;
ELFT::Is64Bits);
}
- std::pair<symbol_iterator, symbol_iterator>
- getELFDynamicSymbolIterators() const override;
+ symbol_iterator_range getDynamicSymbolIterators() const override;
bool isRelocatableObject() const override;
};
}
template <class ELFT>
-std::pair<symbol_iterator, symbol_iterator>
-ELFObjectFile<ELFT>::getELFDynamicSymbolIterators() const {
- return std::make_pair(dynamic_symbol_begin(), dynamic_symbol_end());
+ObjectFile::symbol_iterator_range
+ELFObjectFile<ELFT>::getDynamicSymbolIterators() const {
+ return make_range(dynamic_symbol_begin(), dynamic_symbol_end());
}
template <class ELFT> bool ELFObjectFile<ELFT>::isRelocatableObject() const {
return EF.getHeader()->e_type == ELF::ET_REL;
}
-inline std::pair<symbol_iterator, symbol_iterator>
-getELFDynamicSymbolIterators(const SymbolicFile *Obj) {
- return cast<ELFObjectFileBase>(Obj)->getELFDynamicSymbolIterators();
-}
-
}
}
basic_symbol_iterator IBegin = Obj.symbol_begin();
basic_symbol_iterator IEnd = Obj.symbol_end();
if (DynamicSyms) {
- if (!Obj.isELF()) {
+ const auto *E = dyn_cast<ELFObjectFileBase>(&Obj);
+ if (!E) {
error("File format has no dynamic symbol table", Obj.getFileName());
return;
}
- std::pair<symbol_iterator, symbol_iterator> IDyn =
- getELFDynamicSymbolIterators(&Obj);
- IBegin = IDyn.first;
- IEnd = IDyn.second;
+ auto IDyn = E->getDynamicSymbolIterators();
+ IBegin = IDyn.begin();
+ IEnd = IDyn.end();
}
std::string NameBuffer;
raw_string_ostream OS(NameBuffer);
bool NoSymbolTable = (Module->symbol_begin() == Module->symbol_end());
if (NoSymbolTable && Module->isELF()) {
// Fallback to dynamic symbol table, if regular symbol table is stripped.
- std::pair<symbol_iterator, symbol_iterator> IDyn =
- getELFDynamicSymbolIterators(Module);
- for (symbol_iterator si = IDyn.first, se = IDyn.second; si != se; ++si) {
- addSymbol(*si, OpdExtractor.get(), OpdAddress);
+ auto IDyn = cast<ELFObjectFileBase>(Module)->getDynamicSymbolIterators();
+ for (SymbolRef Sym : IDyn) {
+ addSymbol(Sym, OpdExtractor.get(), OpdAddress);
}
}
}