[PATCH] D73626: [DebugInfo] Fix DebugLine::Prologue::getLength

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 07:49:12 PST 2020


probinson added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:306
+  if (getVersion() >= 5)
+    Length += sizeof(getAddressSize()) + sizeof(SegSelectorSize);
+  return Length;
----------------
I'd just use `+= 2` here, with a comment.  `sizeof(getAddressSize())` took a second to parse, and assumes the getter returns a type that is the same size as the field.


================
Comment at: llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp:246
+
+  // + 10 for smallest length + version fields size.
+  uint64_t ExpectedLength = Prologue.PrologueLength + 10;
----------------
`// + 10 for sizes of DWARF-32 unit length, version, prologue length.`


================
Comment at: llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp:253
+    // Add DWARF64 indicator + length field size increases.
+    ExpectedLength += 12;
+
----------------
`// Unit length grows by 8, prologue length by 4.`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73626





More information about the llvm-commits mailing list