[DWARF] - Refactoring: localize handling of relocations in a single place.

Authored by grimar on Apr 20 2017, 3:08 AM.



This is splitted from D32228,
currently DWARF parsers code has few places that applied relocations values manually.
These places has similar duplicated code. Patch introduces separate method that can be
used to obtain relocated value. That helps to reduce code and simplifies things.

Diff Detail

grimar created this revision.Apr 20 2017, 3:08 AM
davide accepted this revision.Apr 20 2017, 7:22 AM
davide added a subscriber: davide.

This seems a useful cleanup. @aprantl , WDYT?

This revision is now accepted and ready to land.Apr 20 2017, 7:22 AM

LGTM with inline feedback addressed. Thanks!

54 ↗(On Diff #95915)
/// Reads a value from data extractor and applies a relocation to the result if
/// one exists for the given offset.
61 ↗(On Diff #95915)

LLVM tends to prefer early exits:

if (!Relocs)
  return Data.getUnsigned(Off, Size);
This revision was automatically updated to reflect the committed changes.

Thanks, Adrian !