HomePhabricator

[llvm-objcopy][NFC] More error propagation (executeObjcopyOnArchive)

Description

[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

Details

Committed
rupprechtFeb 1 2019, 9:08 AM
Reviewer
dblaikie
Differential Revision
D57462: [llvm-objcopy][NFC] More error propagation (executeObjcopyOnArchive)
Parents
rL352887: Fix some sphinx doc errors.
Branches
Unknown
Tags
Unknown