1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/tools/llvm-readobj
Kevin Enderby bcb0d035e4 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.

Also corrected the code where the size gets us to the “at the end of the archive”
which is OK but past the end of the archive will return object_error::parse_failed now.

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

llvm-svn: 250906
2015-10-21 16:59:24 +00:00
..
ARMAttributeParser.cpp Make a bunch of static arrays const. 2015-10-18 05:15:34 +00:00
ARMAttributeParser.h
ARMEHABIPrinter.h Pass a symbol table to getRelocationSymbol instead of returning one. 2015-09-02 15:07:39 +00:00
ARMWinEHPrinter.cpp Convert getSymbolSection to return an ErrorOr. 2015-08-07 23:27:14 +00:00
ARMWinEHPrinter.h
CMakeLists.txt llvm-readobj: Dump more info for COFF import libraries. 2015-08-28 10:27:50 +00:00
COFFDumper.cpp [COFF] Add IMAGE_SCN_TYPE_NOLOAD to SectionCharacteristics 2015-07-30 16:47:56 +00:00
COFFImportDumper.cpp llvm-readobj: Dump more info for COFF import libraries. 2015-08-28 10:27:50 +00:00
ELFDumper.cpp [llvm-readobj] Teach ELFDumper about symbol versioning. 2015-10-16 23:19:01 +00:00
Error.cpp
Error.h
llvm-readobj.cpp This removes the eating of the error in Archive::Child::getSize() when the characters 2015-10-21 16:59:24 +00:00
llvm-readobj.h llvm-readobj: Handle invalid references to the string table. 2015-07-20 03:38:17 +00:00
LLVMBuild.txt
MachODumper.cpp [llvm-readobj/MachO] Ensure we always have valid CmdName/SegmentName. 2015-09-22 02:14:43 +00:00
Makefile
ObjDumper.cpp
ObjDumper.h [llvm-readobj] Teach ELFDumper about symbol versioning. 2015-10-16 23:19:01 +00:00
StackMapPrinter.h [StackMaps] Add a lightweight parser for stackmap version 1 sections. 2015-06-26 23:56:53 +00:00
StreamWriter.cpp
StreamWriter.h StreamWriter: List basic types instead of derived ones in HexNumber 2015-10-17 00:08:45 +00:00
Win64EHDumper.cpp Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type extra times. NFC 2015-09-21 05:32:41 +00:00
Win64EHDumper.h