llvm-project/llvm/tools
Kevin Enderby e3bf4fd546 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
..
bugpoint bugpoint: Remove implicit ilist iterator conversions, NFC 2015-10-20 19:36:39 +00:00
bugpoint-passes bugpoint Enhancement. 2015-04-20 23:42:22 +00:00
dsymutil This removes the eating of the error in Archive::Child::getSize() when the characters 2015-10-21 16:59:24 +00:00
gold Make class final to pacify -Wnon-virtual-dtor. 2015-10-20 08:21:01 +00:00
llc Remove access to the DataLayout in the TargetMachine 2015-07-24 16:04:22 +00:00
lli [Orc] Add support for emitting indirect stubs directly into the JIT target's 2015-10-19 17:43:51 +00:00
llvm-ar This removes the eating of the error in Archive::Child::getSize() when the characters 2015-10-21 16:59:24 +00:00
llvm-as Support for function summary index bitcode sections and files. 2015-10-04 14:33:43 +00:00
llvm-as-fuzzer [libFuzzer] make LLVMFuzzerTestOneInput (the fuzzer target function) return int instead of void. The actual return value is not *yet* used (and expected to be 0). This change is API breaking, so the fuzzers will need to be updated. 2015-10-02 23:34:06 +00:00
llvm-bcanalyzer Revert "Add missing #include, found by modules build." 2015-10-21 06:10:55 +00:00
llvm-c-test Fix build breakage caused by memory leaks in llvm-c-test 2015-01-28 18:32:31 +00:00
llvm-config llvm-config: Add --build-system option 2015-09-09 16:39:30 +00:00
llvm-cov [llvm-cov] Adjust column widths for function and file reports 2015-10-21 16:03:32 +00:00
llvm-cxxdump This removes the eating of the error in Archive::Child::getSize() when the characters 2015-10-21 16:59:24 +00:00
llvm-diff llvm-diff: Remove implicit ilist iterator conversions, NFC 2015-10-20 18:17:05 +00:00
llvm-dis Use std::unique_ptr to manage the DataStreamer in bitcode parsing. 2015-06-16 23:29:49 +00:00
llvm-dwarfdump [dwarfdump] Add support for dumping mach-o universal objectfiles 2015-08-03 00:10:31 +00:00
llvm-extract uselistorder: Remove the global bits 2015-04-15 03:14:06 +00:00
llvm-go Enable linking tools, shared libraries against libLLVM 2015-09-01 03:14:31 +00:00
llvm-jitlistener Fix the -DBUILD_SHARED_LIBS=ON build. 2015-07-07 17:48:00 +00:00
llvm-link New bitcode linker flags: 2015-09-01 17:55:55 +00:00
llvm-lto Pass FunctionInfoIndex by reference to WriteFunctionSummaryToFile (NFC) 2015-10-19 19:06:06 +00:00
llvm-mc Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC. 2015-09-15 16:17:27 +00:00
llvm-mc-fuzzer [libFuzzer] make LLVMFuzzerTestOneInput (the fuzzer target function) return int instead of void. The actual return value is not *yet* used (and expected to be 0). This change is API breaking, so the fuzzers will need to be updated. 2015-10-02 23:34:06 +00:00
llvm-mcmarkup Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr 2014-08-21 20:44:56 +00:00
llvm-nm This removes the eating of the error in Archive::Child::getSize() when the characters 2015-10-21 16:59:24 +00:00
llvm-objdump This removes the eating of the error in Archive::Child::getSize() when the characters 2015-10-21 16:59:24 +00:00
llvm-pdbdump Make windows.h less evil. 2015-10-15 09:38:45 +00:00
llvm-profdata Re-apply r249644: Handle inline stacks in gcov-encoded sample profiles. 2015-10-08 19:40:37 +00:00
llvm-readobj This removes the eating of the error in Archive::Child::getSize() when the characters 2015-10-21 16:59:24 +00:00
llvm-rtdyld [JIT] TrivialMemoryManager: Fail if we can't allocate memory. 2015-10-15 00:05:32 +00:00
llvm-shlib [CMake] Add LLVM_VERSION_PATCH to the -current_version flag for libLTO and libLLVM. 2015-10-14 07:50:21 +00:00
llvm-size This removes the eating of the error in Archive::Child::getSize() when the characters 2015-10-21 16:59:24 +00:00
llvm-split TransformUtils: Introduce module splitter. 2015-08-21 02:48:20 +00:00
llvm-stress [PM/AA] Remove the last relics of the separate IPA library from LLVM, 2015-08-18 17:51:53 +00:00
llvm-symbolizer Speculative fix for GCC build 2015-10-16 23:53:12 +00:00
lto [CMake] Add LLVM_VERSION_PATCH to the -current_version flag for libLTO and libLLVM. 2015-10-14 07:50:21 +00:00
msbuild MSBuild integration: fix the loop in install.bat 2014-09-30 22:30:06 +00:00
obj2yaml [obj2yaml] Fix "time of check to time of use" bug. Add a test. 2015-09-19 20:49:34 +00:00
opt [PM/AA] Remove the last relics of the separate IPA library from LLVM, 2015-08-18 17:51:53 +00:00
verify-uselistorder [uselistorder] Insert blank line, NFC 2015-10-13 21:51:02 +00:00
xcode-toolchain [CMake] [Darwin] Add support for generating Xcode-compatible toolchains that xcodebuild and xcrun can search 2015-10-15 20:09:01 +00:00
yaml2obj [yaml2obj] Support numeric indexes to create invalid files. Will be used by lld test. 2015-08-27 23:11:20 +00:00
CMakeLists.txt [CMake] We need to explicitly add llvm-config before clang so that LLVM_BUILD_EXTERNAL_COMPILER_RT can depend on llvm-config. 2015-10-02 22:28:48 +00:00
LLVMBuild.txt Remove macho-dump. Its functionality is now covered by llvm-readobj. 2015-09-22 17:46:10 +00:00
Makefile Remove macho-dump. Its functionality is now covered by llvm-readobj. 2015-09-22 17:46:10 +00:00