llvm-project/llvm/tools/llvm-objcopy
Jordan Rupprecht 18886db211 [llvm-objcopy][NFC] More error propagation (executeObjcopyOnArchive)
Summary:
Replace some reportError() calls with error propagation that was missed from rL352625.

Note this also adds an error check during Archive iteration that was being hidden by a different error check before:

```
  for (const Archive::Child &Child : Ar.children(Err)) {
    Expected<std::unique_ptr<Binary>> ChildOrErr = Child.getAsBinary();
    if (!ChildOrErr)
      // This aborts, so Err is never checked
      reportError(Ar.getFileName(), ChildOrErr.takeError());
```

Err is being checked after the loop, so during happy runs, everything is fine. But when reportError is changed to return the error instead of aborting, the fact that Err is never checked is now noticed in tests that trigger an error during the loop.

Reviewers: jhenderson, dblaikie, alexshap

Reviewed By: dblaikie

Subscribers: llvm-commits, lhames, jakehehrlich

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57462

llvm-svn: 352888
2019-02-01 17:08:07 +00:00
..
COFF [llvm-objcopy] Support -X|--discard-locals. 2019-01-30 14:58:13 +00:00
ELF [llvm-objcopy][NFC] Propagate errors in removeSymbols/removeSectionReferences 2019-02-01 15:20:36 +00:00
Buffer.cpp [llvm-objcopy] Fix crash when writing empty binary output 2019-01-28 15:02:40 +00:00
Buffer.h [llvm-objcopy] Fix crash when writing empty binary output 2019-01-28 15:02:40 +00:00
CMakeLists.txt [llvm-objcopy] [COFF] Add support for removing symbols 2019-01-10 21:28:24 +00:00
CopyConfig.cpp [llvm-strip] Implement --keep-file-symbols 2019-02-01 15:25:15 +00:00
CopyConfig.h [llvm-objcopy] Support -X|--discard-locals. 2019-01-30 14:58:13 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ObjcopyOpts.td [llvm-objcopy] Support -X|--discard-locals. 2019-01-30 14:58:13 +00:00
StripOpts.td [llvm-strip] Implement --keep-file-symbols 2019-02-01 15:25:15 +00:00
llvm-objcopy.cpp [llvm-objcopy][NFC] More error propagation (executeObjcopyOnArchive) 2019-02-01 17:08:07 +00:00
llvm-objcopy.h [llvm-objcopy] Return Error from Buffer::allocate(), [ELF]Writer::finalize(), and [ELF]Writer::commit() 2019-01-22 23:49:16 +00:00