[PATCH] D64631: [obj2yaml] - Rework tool's error reporting logic for ELF target.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 06:21:26 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added a subscriber: aheejin.

`ELF.h` contains two `getSymbol` methods
which seems to be used only from `obj2yaml`.

One of these methods calls another, which in turn
contains untested error message which doesn't
provide enough information.

Problem is that after improving only just that message,
`obj2yaml` will not show it,
("Error reading file: yaml: Invalid data was
encountered while parsing the file" message will be shown instead),
because internal errors handling of tool is based on `ErrorOr<>` class which
stores a error code and as a result can only show a predefined error string, what
actually isn't very useful.

In this patch, I rework `obj2yaml`'s error reporting system
for ELF targets to use `Error`   `Expected<>` classes.
Also, I improve the error message produced
by `getSymbol` for demonstration of the new functionality.


https://reviews.llvm.org/D64631

Files:
  include/llvm/Object/ELF.h
  test/tools/obj2yaml/section-group.test
  test/tools/obj2yaml/special-symbol-indices.yaml
  tools/obj2yaml/elf2yaml.cpp
  tools/obj2yaml/obj2yaml.cpp
  tools/obj2yaml/obj2yaml.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64631.209472.patch
Type: text/x-patch
Size: 30068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190712/23c547e9/attachment.bin>


More information about the llvm-commits mailing list