Return ErrorOr from getSection.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 1 Jul 2015 12:56:27 +0000 (12:56 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 1 Jul 2015 12:56:27 +0000 (12:56 +0000)
commitdf3edb6d36cb47eb6f3e992b6edb884bf40c619b
tree77fa5024c7195b134699e6273353f47846e67b96
parent37cb5f1c2db9f42d29f26b215585f56bb64ae4f5
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
include/llvm/Object/ELF.h
include/llvm/Object/ELFObjectFile.h
include/llvm/Object/Error.h
lib/Object/Error.cpp
test/Object/invalid.test
tools/llvm-objdump/llvm-objdump.cpp
tools/llvm-readobj/ARMEHABIPrinter.h
tools/llvm-readobj/ELFDumper.cpp
tools/obj2yaml/elf2yaml.cpp