[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.
commit8df291e7a691c66c6f6d5be7f89171f57fa9fc92
authorGeorge Rimar <grimar@accesssoftek.com>
Sat, 17 Aug 2019 14:36:40 +0000 (17 14:36 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Sat, 17 Aug 2019 14:36:40 +0000 (17 14:36 +0000)
tree2f74f06d8e22bbfbdb0ff4ddc0e40f07f8d1e212
parentbb6e86a613ead753394ad73641ec346ae774335a
[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.

urrently we have the following functions for error reporting:

--
LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
void reportError(Error Err, StringRef Input);
void reportWarning(Twine Msg);
void reportWarning(StringRef Input, Error Err);
void warn(llvm::Error Err);
void error(std::error_code EC);
---

Problems are: naming is inconsistent, arguments order is inconsistent,
some of the functions looks excessive.

After applying this patch we have:

---
LLVM_ATTRIBUTE_NORETURN void reportError(Error Err, StringRef Input);
LLVM_ATTRIBUTE_NORETURN void reportError(std::error_code EC, StringRef Input);
void reportWarning(Error Err, StringRef Input);
---

I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it
is used by COFF heavily.

Test cases were updated, they show an improvement introduced.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369190 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
test/Object/invalid.test
test/tools/llvm-readobj/elf-broken-dynsym-link.test
test/tools/llvm-readobj/elf-dynamic-malformed.test
test/tools/llvm-readobj/elf-dynamic-not-in-pt-dynamic.test
test/tools/llvm-readobj/elf-malformed-pt-dynamic.test
test/tools/llvm-readobj/elf-non-dynamic-in-pt-dynamic.test
test/tools/llvm-readobj/hex-dump.test
test/tools/llvm-readobj/mips-got.test
test/tools/llvm-readobj/note-core-ntfile-bad.test
test/tools/llvm-readobj/string-dump.test
tools/llvm-readobj/COFFDumper.cpp
tools/llvm-readobj/DwarfCFIEHPrinter.h
tools/llvm-readobj/ELFDumper.cpp
tools/llvm-readobj/MachODumper.cpp
tools/llvm-readobj/ObjDumper.cpp
tools/llvm-readobj/llvm-readobj.cpp
tools/llvm-readobj/llvm-readobj.h