[PATCH] D117124: [DWARF][DebugInfo] Fix off-by-one error in size of DW_TAG_base_type types

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 10:06:57 PST 2022


probinson added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1585
+    // Round up to smallest number of bytes that contains this number of bits.
+    uint64_t NumBytes = (static_cast<uint64_t>(Btr.BitSize) + 7) / 8;
+    addUInt(Die, dwarf::DW_AT_byte_size, None, NumBytes);
----------------
You'd think there would be a convenience macro for this, but I'm not finding one.  I do have a memory that someone started making some changes to remove the hard-coded assumption about 8-bit bytes, but it's vague and unless someone else can come up with an example of doing this differently, it's not a blocker.


================
Comment at: llvm/test/DebugInfo/X86/base-type-size.ll:14
+; CHECK:    DW_AT_encoding  (DW_ATE_unsigned)
+; CHECK:    DW_AT_byte_size (0x01)
+
----------------
Needs CHECK-NEXT to ensure the name/encoding/byte_size all belong to the same DIE.
(If this isn't the first base_type, that may be slightly tricky...)


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

https://reviews.llvm.org/D117124



More information about the llvm-commits mailing list