[llvm-readelf/llvm-readobj] - Improved the error reporting in a few method related...
authorGeorgii Rymar <grimar@accesssoftek.com>
Thu, 5 Dec 2019 14:59:34 +0000 (17:59 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Tue, 10 Dec 2019 10:08:18 +0000 (13:08 +0300)
commitdac5ddb482361cde11ac43e94c43acc94a3b78aa
tree6d686f62af013b4ffb8fa76918845242c93abb17
parentbfb53c55b8a825f6ec6bb4170eb80afeaef0fab8
[llvm-readelf/llvm-readobj] - Improved the error reporting in a few method related to versioning.

I was investigating a change previously discussed that eliminates an excessive
empty lines from the output when we report warnings and errors
(https://reviews.llvm.org/D70826#inline-639055) and found
that we need this refactoring or alike to achieve that.

The problem is that some of our functions that finds symbol versions just
fail instead of returning errors or printing warnings. Another problem
is that they might print a warning on the same line with the regular output.
In this patch I've splitted getting of the version information and dumping of it
for GNU printVersionSymbolSection(). I had to change a few methods to return
Error or Expected<> to do that properly.

Differential revision: https://reviews.llvm.org/D71118
llvm/test/Object/invalid.test
llvm/test/tools/llvm-readobj/ELF/verdef-invalid.test
llvm/test/tools/llvm-readobj/ELF/verneed-invalid.test
llvm/test/tools/llvm-readobj/ELF/versym-invalid.test
llvm/tools/llvm-readobj/ELFDumper.cpp