llvm/lib/Object
Kevin Enderby 268709a810 Reapply r250906 with many suggested updates from Rafael Espindola.
The needed lld matching changes to be submitted immediately next,
but this revision will cause lld failures with this alone which is expected.

This removes the eating of the error in Archive::Child::getSize() when the characters
in the size field in the archive header for the member is not a number.  To do this we
have all of the needed methods return ErrorOr to push them up until we get out of lib.
Then the tools and can handle the error in whatever way is appropriate for that tool.

So the solution is to plumb all the ErrorOr stuff through everything that touches archives.
This include its iterators as one can create an Archive object but the first or any other
Child object may fail to be created due to a bad size field in its header.

Thanks to Lang Hames on the changes making child_iterator contain an
ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add
operator overloading for * and -> .

We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash”
and using report_fatal_error() to move the error checking will cause the program to
stop, neither of which are really correct in library code. There are still some uses of
these that should be cleaned up in this library code for other than the size field.

The test cases use archives with text files so one can see the non-digit character,
in this case a ‘%’, in the size field.

These changes will require corresponding changes to the lld project.  That will be
committed immediately after this change.  But this revision will cause lld failures
with this alone which is expected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 19:24:56 +00:00
..
Archive.cpp Reapply r250906 with many suggested updates from Rafael Espindola. 2015-11-05 19:24:56 +00:00
ArchiveWriter.cpp Reapply r250906 with many suggested updates from Rafael Espindola. 2015-11-05 19:24:56 +00:00
Binary.cpp
CMakeLists.txt Support for function summary index bitcode sections and files. 2015-10-04 14:33:43 +00:00
COFFObjectFile.cpp Address review comments, remove error case and return 0 instead as required by tests 2015-10-09 00:15:08 +00:00
COFFYAML.cpp [COFF] Add IMAGE_SCN_TYPE_NOLOAD to SectionCharacteristics 2015-07-30 16:47:56 +00:00
ELF.cpp [ELF] elfiamcu triple should imply e_machine == EM_IAMCU 2015-11-04 11:21:50 +00:00
ELFObjectFile.cpp
ELFYAML.cpp [ELF] elfiamcu triple should imply e_machine == EM_IAMCU 2015-11-04 11:21:50 +00:00
Error.cpp Add dynamic_table iterators back to ELF.h. 2015-08-07 15:25:20 +00:00
FunctionIndexObjectFile.cpp Restore "Support for ThinLTO function importing and symbol linking." 2015-11-03 00:14:15 +00:00
IRObjectFile.cpp
LLVMBuild.txt
MachOObjectFile.cpp Fix a bug in llvm-objdump’s printing of Objective-C meta data 2015-10-08 22:50:55 +00:00
MachOUniversal.cpp Use early return NFC. 2015-08-03 00:10:33 +00:00
Makefile
Object.cpp Convert getSymbolSection to return an ErrorOr. 2015-08-07 23:27:14 +00:00
ObjectFile.cpp Convert getSymbolSection to return an ErrorOr. 2015-08-07 23:27:14 +00:00
RecordStreamer.cpp
RecordStreamer.h
SymbolicFile.cpp Re-apply r246276 - Object: Teach llvm-ar to create symbol table for COFF short import files 2015-08-28 07:40:30 +00:00
SymbolSize.cpp