[PATCH] D32284: [DWARF] - Refactoring: localize handling of relocations in a single place.
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 09:04:27 PDT 2017
aprantl added a comment.
LGTM with inline feedback addressed. Thanks!
================
Comment at: include/llvm/DebugInfo/DWARF/DWARFContext.h:54
+// Reads a value from data extractor and applies relocation to result if
+// relocation is exist for given offset.
+uint64_t getRelocatedValue(const DataExtractor &Data, uint32_t Size,
----------------
```
/// Reads a value from data extractor and applies a relocation to the result if
/// one exists for the given offset.
```
================
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:61
+ uint32_t *Off, const RelocAddrMap *Relocs) {
+ if (Relocs) {
+ RelocAddrMap::const_iterator AI = Relocs->find(*Off);
----------------
LLVM tends to prefer early exits:
```
if (!Relocs)
return Data.getUnsigned(Off, Size);
...
```
https://reviews.llvm.org/D32284
More information about the llvm-commits
mailing list