This is an archive of the discontinued LLVM Phabricator instance.

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

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

Details

Summary

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

Repository
rL LLVM

Event Timeline

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!

include/llvm/DebugInfo/DWARF/DWARFContext.h
54 ↗(On Diff #95915)
/// Reads a value from data extractor and applies a relocation to the result if
/// one exists for the given offset.
lib/DebugInfo/DWARF/DWARFContext.cpp
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 !