[llvm-dwp] Refactor handling of section identifiers. NFCI.
authorIgor Kudrin <ikudrin@accesssoftek.com>
Wed, 11 Mar 2020 14:54:51 +0000 (21:54 +0700)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 6 Apr 2020 06:28:05 +0000 (13:28 +0700)
commitf9cd90837bdced66c933349b402c322f7198ddfe
treea64c06db785b330db1f52e3c6131044e8a619367
parent6163aa96799cbad7f2f58e02c5bebee9647056a5
[llvm-dwp] Refactor handling of section identifiers. NFCI.

There is a number of places in llvm-dwp.cpp where a section identifier
is translated into an index of an internal array of section
contributions, and another place where the index is converted to an
on-disk value. All these places use direct expressions like
"<id> - DW_SECT_INFO" or "<index> + DW_SECT_INFO", exploiting the fact
that DW_SECT_INFO is the minimum valid value of that kind.

The patch adds distinct functions for that translation. The goal is to
make the code more readable and to prepare it to support index sections
of new versions, where the numeric scheme of section indexes is changed.

Differential Revision: https://reviews.llvm.org/D76067
llvm/tools/llvm-dwp/llvm-dwp.cpp