Right but isn’t there a DWARF64_HEADER and DEARF32_HEADER struct somewhere?  This way you could just say <br><br>  return m_isdwarf64 ? sizeof(DWARF64_HEADER) : sizeof(DWARF32_HEADER);<br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 20, 2017 at 7:50 AM Greg Clayton <<a href="mailto:clayborg@gmail.com">clayborg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Nov 19, 2017, at 4:56 PM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:</div><br class="m_-6047306128612448630Apple-interchange-newline"><div><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Sun, Nov 19, 2017 at 6:35 AM Jan Kratochvil via Phabricator via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This revision was automatically updated to reflect the committed changes.<br>
Closed by commit rL318626: Add comments to DWARFCompileUnit length fields/methods (authored by jankratochvil).<br>
<br>
Changed prior to commit:<br>
  <a href="https://reviews.llvm.org/D40211?vs=123472&id=123498#toc" rel="noreferrer" target="_blank">https://reviews.llvm.org/D40211?vs=123472&id=123498#toc</a><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D40211" rel="noreferrer" target="_blank">https://reviews.llvm.org/D40211</a><br>
<br>
Files:<br>
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h<br>
<br>
<br>
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h<br>
===================================================================<br>
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h<br>
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h<br>
@@ -41,26 +41,24 @@<br>
   void Clear();<br>
   bool Verify(lldb_private::Stream *s) const;<br>
   void Dump(lldb_private::Stream *s) const;<br>
+  // Offset of the initial length field.<br>
   dw_offset_t GetOffset() const { return m_offset; }<br>
   lldb::user_id_t GetID() const;<br>
-  uint32_t Size() const {<br>
-    return m_is_dwarf64 ? 23<br>
-                        : 11; /* Size in bytes of the compile unit header */<br>
-  }<br>
+  // Size in bytes of the initial length + compile unit header.<br>
+  uint32_t Size() const { return m_is_dwarf64 ? 23 : 11; }<br></blockquote><div><br></div><div>This is pretty gross.  Don't we have a structure somewhere that represents a compile unit header?  That we can just call sizeof on?  Same goes for the rest of the patch</div></div></div>
</div></blockquote></div><br></div><div style="word-wrap:break-word"><div>It varies depending on data on how the length unit is represented in the data stream. If the length starts with UINT32_MAX, it is followed by a 64 bit length. If the length isn't UINT32_MAX it is just a 32 bit length. </div></div></blockquote></div>