[PATCH] D67182: [lib/ObjectYAML] - Improve and cleanup error reporting in ELFState<ELFT> class.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 08:26:48 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.

The aim of this patch is to refactor how we handle and report error.

I suggest to use the same approach we use in LLD: delayed error reporting.
For that I introduced 'HasError' flag which triggers when we report an error.
Now we do not exit instantly on any error. The benefits are:

1. There are no more 'exit(1)' calls in the library code.
2. Code was simplified significantly in a few places.
3. It is now possible to print multiple errors instead of only one.

Also, I changed the messages to be lower case and removed a full stop.

It is rebased on top of D67157 <https://reviews.llvm.org/D67157>.


https://reviews.llvm.org/D67182

Files:
  lib/ObjectYAML/ELFEmitter.cpp
  test/tools/yaml2obj/duplicate-section-names.test
  test/tools/yaml2obj/duplicate-symbol-names.test
  test/tools/yaml2obj/dynamic-section-raw-content.yaml
  test/tools/yaml2obj/dynamic-symbols.yaml
  test/tools/yaml2obj/dynsymtab-implicit-sections-size-content.yaml
  test/tools/yaml2obj/elf-custom-null-section.yaml
  test/tools/yaml2obj/program-header.yaml
  test/tools/yaml2obj/relocation-missing-symbol.yaml
  test/tools/yaml2obj/symtab-implicit-sections-size-content.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67182.218714.patch
Type: text/x-patch
Size: 29081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190904/37487359/attachment.bin>


More information about the llvm-commits mailing list