mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
Return ErrorOr from SymbolRef::getName.
This function can really fail since the string table offset can be out of bounds. Using ErrorOr makes sure the error is checked. Hopefully a lot of the boilerplate code in tools/* can go away once we have a diagnostic manager in Object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241297 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -195,8 +195,7 @@ protected:
|
||||
ELFFile<ELFT> EF;
|
||||
|
||||
void moveSymbolNext(DataRefImpl &Symb) const override;
|
||||
std::error_code getSymbolName(DataRefImpl Symb,
|
||||
StringRef &Res) const override;
|
||||
ErrorOr<StringRef> getSymbolName(DataRefImpl Symb) const override;
|
||||
std::error_code getSymbolAddress(DataRefImpl Symb,
|
||||
uint64_t &Res) const override;
|
||||
uint64_t getSymbolValue(DataRefImpl Symb) const override;
|
||||
@ -349,14 +348,9 @@ void ELFObjectFile<ELFT>::moveSymbolNext(DataRefImpl &Sym) const {
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::getSymbolName(DataRefImpl Sym,
|
||||
StringRef &Result) const {
|
||||
ErrorOr<StringRef> ELFObjectFile<ELFT>::getSymbolName(DataRefImpl Sym) const {
|
||||
const Elf_Sym *ESym = toELFSymIter(Sym);
|
||||
ErrorOr<StringRef> Name = EF.getSymbolName(ESym, Sym.p & 1);
|
||||
if (!Name)
|
||||
return Name.getError();
|
||||
Result = *Name;
|
||||
return std::error_code();
|
||||
return EF.getSymbolName(ESym, Sym.p & 1);
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
|
Reference in New Issue
Block a user