[PATCH] D88113: [llvm-objcopy][NFC] refactor error handling. part 1.
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 00:17:36 PDT 2020
alexshap added a comment.
apart from the minor comment above, I think this change is in the right direction. Looks good.
================
Comment at: llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp:358
MachOReader Reader(In);
- std::unique_ptr<Object> O = Reader.create();
- if (!O)
- return createFileError(
- Config.InputFilename,
- createStringError(object_error::parse_failed,
- "unable to deserialize MachO object"));
-
- if (Error E = handleArgs(Config, *O))
+ Expected<std::unique_ptr<Object>> ObjOrErr = Reader.create();
+ if (!ObjOrErr)
----------------
nit: perhaps, I'd keep the old name of the variable (simply O) because ObjOrErr somehow appears to suggest that the type of this variable is ErrorOr<...> (https://llvm.org/doxygen/classllvm_1_1ErrorOr.html ) which is not the case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88113/new/
https://reviews.llvm.org/D88113
More information about the llvm-commits
mailing list