mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 22:23:10 +00:00
Return ErrorOr from getSection.
This also improves the logic of what is an error: * getSection(uint_32): only return an error if the index is out of bounds. The index 0 corresponds to a perfectly valid entry. * getSection(Elf_Sym): Returns null for symbols that normally don't have sections and error for out of bound indexes. In many places this just moves the report_fatal_error up the stack, but those can then be fixed in smaller patches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241156 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -377,7 +377,10 @@ PrinterContext<ET>::FindExceptionTable(unsigned IndexSectionIndex,
|
||||
std::pair<const Elf_Shdr *, const Elf_Sym *> Symbol =
|
||||
ELF->getRelocationSymbol(&Sec, &RelA);
|
||||
|
||||
return ELF->getSection(Symbol.second);
|
||||
ErrorOr<const Elf_Shdr *> Ret = ELF->getSection(Symbol.second);
|
||||
if (std::error_code EC = Ret.getError())
|
||||
report_fatal_error(EC.message());
|
||||
return *Ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user