[lib/ObjectYAML] - Improve and cleanup error reporting in ELFState<ELFT> class.
commit2d48101294859b8b91196576d64d1c9d78e621cb
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 9 Sep 2019 09:43:03 +0000 (9 09:43 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 9 Sep 2019 09:43:03 +0000 (9 09:43 +0000)
treec8712d02553cebb37021540ca52f0e5035ec8a7a
parent3c344aa199857ed65121e6ae703dfb7be36ad2ef
[lib/ObjectYAML] - Improve and cleanup error reporting in ELFState<ELFT> class.

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.

Differential revision: https://reviews.llvm.org/D67182

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371380 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
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-comdat-broken-info.yaml
test/tools/yaml2obj/elf-comdat-broken-members.yaml [new file with mode: 0644]
test/tools/yaml2obj/elf-custom-null-section.yaml
test/tools/yaml2obj/program-header.yaml
test/tools/yaml2obj/reloc-sec-info.yaml
test/tools/yaml2obj/relocation-missing-symbol.yaml
test/tools/yaml2obj/section-link.yaml
test/tools/yaml2obj/symtab-implicit-sections-size-content.yaml