[PATCH] D74560: [WIP] Introduce DWARFDataExtractor::getInitialLength

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 05:37:36 PST 2020


labath marked an inline comment as done.
labath added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h:45
+
+  std::pair<uint64_t, dwarf::DwarfFormat> getInitialLength(Cursor &C) const {
+    return getInitialLength(&getOffset(C), &getError(C));
----------------
ikudrin wrote:
> Would it be simpler if you implement `getInitialLength(uint64_t *, Error *)` via `getInitialLength(Cursor &)`? You anyway create a Cursor inside `getInitialLength(uint64_t *, Error *)`.
I don't think that would help very much (or at all). The second cursor comes from a desire to not modify the original offset in case we fail to read the entire initial length field. I am not sure if any of the potential users would really need this behavior, but that is how the rest of the DataExtractor functions operate, so I thought it'd be good to maintain that.

If we stick to that requirement, then I'd still need to have two cursors (or offsets, or something) and fiddle around with them. If we drop it, we wouldn't need the second Cursor even in the current setup.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74560/new/

https://reviews.llvm.org/D74560





More information about the llvm-commits mailing list