[PATCH] D66286: [llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 04:14:23 PDT 2019
grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, rupprecht.
Herald added subscribers: seiya, atanasyan.
Currently 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:
void reportError(Error Err, StringRef Input);
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.
https://reviews.llvm.org/D66286
Files:
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66286.215367.patch
Type: text/x-patch
Size: 55292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/4c51044d/attachment.bin>
More information about the llvm-commits
mailing list