[llvm-readobj] Improve error message for --string-dump
authorStephen Tozer <stephen.tozer@sony.com>
Fri, 5 Apr 2019 16:15:50 +0000 (16:15 +0000)
committerStephen Tozer <stephen.tozer@sony.com>
Fri, 5 Apr 2019 16:15:50 +0000 (16:15 +0000)
commit681b0798dbbc6b3500c9930977ec8a274b142acb
tree09416478f4286b865120010561943098cbf97980
parented7f8e6509ba6997b12281acd41fbeddc0d27216
[llvm-readobj] Improve error message for --string-dump

Fixes bug 40630: https://bugs.llvm.org/show_bug.cgi?id=40630

This patch changes the error message when the section specified by
--string-dump cannot be found by including the name of the section in
the error message and changing the prefix text to not imply that the
file itself was invalid. As part of this change some uses of
std::error_code have been replaced with the llvm Error class to better
encapsulate the error info (rather than passing File strings around),
and the WithColor class replaces string literal error prefixes.

Differential Revision: https://reviews.llvm.org/D59946

llvm-svn: 357772
16 files changed:
llvm/test/tools/llvm-readobj/basic.test
llvm/test/tools/llvm-readobj/codeview-merging-cycle.test
llvm/test/tools/llvm-readobj/elf-dynamic-malformed.test
llvm/test/tools/llvm-readobj/elf-malformed-pt-dynamic.test
llvm/test/tools/llvm-readobj/elf-packed-relocs-error1.s
llvm/test/tools/llvm-readobj/elf-packed-relocs-error2.s
llvm/test/tools/llvm-readobj/elf-packed-relocs-error3.s
llvm/test/tools/llvm-readobj/elf-packed-relocs-error4.s
llvm/test/tools/llvm-readobj/elf-packed-relocs-error5.s
llvm/test/tools/llvm-readobj/mips-got.test
llvm/test/tools/llvm-readobj/string-dump.test
llvm/test/tools/llvm-readobj/thin-archive-paths.test
llvm/test/tools/llvm-readobj/thin-archive.test
llvm/test/tools/llvm-readobj/wasm-invalid.test
llvm/tools/llvm-readobj/ObjDumper.cpp
llvm/tools/llvm-readobj/llvm-readobj.cpp