llvm-project/llvm/tools/dsymutil
Kevin Enderby 7a96942a6a 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.

llvm-svn: 252192
2015-11-05 19:24:56 +00:00
..
BinaryHolder.cpp Reapply r250906 with many suggested updates from Rafael Espindola. 2015-11-05 19:24:56 +00:00
BinaryHolder.h [dsymutil] Implement support for universal mach-o object files. 2015-07-24 06:41:11 +00:00
CMakeLists.txt [dsymutil] Implement support for handling mach-o universal binaries as main input/output. 2015-08-05 18:27:44 +00:00
DebugMap.cpp [dsymutil] Store an optional BinaryPath in the debug map. 2015-08-26 05:09:59 +00:00
DebugMap.h [dsymutil] Store an optional BinaryPath in the debug map. 2015-08-26 05:09:59 +00:00
DwarfLinker.cpp Test commit: fix typo in comment. 2015-10-23 17:10:44 +00:00
LLVMBuild.txt [dsymutil] Add the DwarfStreamer class. 2015-02-28 00:29:11 +00:00
MachODebugMapParser.cpp Fix Clang-tidy modernize-use-nullptr warnings in source directories and generated files; other minor cleanups. 2015-10-06 23:24:35 +00:00
MachOUtils.cpp [dsymutil] Try to find lipo first besides dsymutil before looking up the PATH. 2015-10-08 22:35:53 +00:00
MachOUtils.h [dsymutil] Try to find lipo first besides dsymutil before looking up the PATH. 2015-10-08 22:35:53 +00:00
Makefile [dsymutil] Add the DwarfStreamer class. 2015-02-28 00:29:11 +00:00
NonRelocatableStringpool.h [dsymutil] Split NonRelocatableStringPool into its own file. NFC. 2015-08-26 05:09:52 +00:00
dsymutil.cpp [dsymutil] Prevent warning 2015-10-09 15:04:05 +00:00
dsymutil.h dsymutil: Fix a comment. [-Wdocumentation] 2015-09-23 00:19:20 +00:00