[llvm-readobj] - Refactor the code that dumps relocations.
authorGeorgii Rymar <grimar@accesssoftek.com>
Thu, 13 Feb 2020 12:12:31 +0000 (15:12 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Sun, 16 Feb 2020 11:39:24 +0000 (14:39 +0300)
commit22ebf08006a5b17a4ff6aed09ec5b72867338458
treed5e60f76a412e613913f23f705e50546e6441543
parent857b655d7aac50462ffd0154b9d6c4f18119ddfb
[llvm-readobj] - Refactor the code that dumps relocations.

The current code has following issues:
1) It has a duplicated logic part.
2) This logic relies on unwrapOrError calls, but if we want to convert
   them to warnings, we will need to change all of them what is hard to do
   because of the duplication.

In this patch I've created a new method that returns Expected<> what allows
now to catch all errors in a single place and remove the code duplication.

Note: this change is itself a refactor NFC. It does not change the current logic
anyhow. It prepares the code for the follow-up(s).

Differential revision: https://reviews.llvm.org/D74545
llvm/tools/llvm-readobj/ELFDumper.cpp