[PATCH] D26567: Improve DWARF parsing speed by improving DWARFAbbreviationDeclaration

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 15:05:01 PST 2016


aprantl added a comment.

Couple of stylistic comments inline, but otherwise this is fine from my end unless David sees anything.



================
Comment at: lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp:178
+  size_t ByteSize = NumBytes;
+  if (NumAddrs > 0)
+    ByteSize += NumAddrs * U.getAddressByteSize();
----------------
`> 0` is redundant since NumAddrs is unsigned. I would either use `!= 0` of if (NumAddrs).

Actually, it looks like the entire condition is redundant. If NumAddrs is 0 then the next line will be a noop.


================
Comment at: lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp:221
+    // Check if this attribute has a fixed byte size.
+    Optional<uint8_t> FixedSize = AttrSpec.getByteSize(U);
+    if (FixedSize) {
----------------
roll into the condition?


================
Comment at: lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp:248
     dwarf::Attribute Attr, DWARFFormValue &FormValue) const {
-  if (!AbbrevDecl)
+  if (!AbbrevDecl || !U)
     return false;
----------------
I don't like that U can be null here but that's for another patch :-)


https://reviews.llvm.org/D26567





More information about the llvm-commits mailing list