[llvm] [LLVM][DWARF] Change .debug_names abbrev to be an index (PR #81200)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 08:58:33 PST 2024


================
@@ -536,14 +513,13 @@ void Dwarf5AccelTableWriter::emitStringOffsets() const {
 
 void Dwarf5AccelTableWriter::emitAbbrevs() const {
   Asm->OutStreamer->emitLabel(AbbrevStart);
-  for (const auto &Abbrev : Abbreviations) {
+  for (const DebugNamesAbbrev *Abbrev : AbbreviationsVector) {
     Asm->OutStreamer->AddComment("Abbrev code");
-    uint32_t Tag = getTagFromAbbreviationTag(Abbrev.first);
-    assert(Tag != 0);
-    Asm->emitULEB128(Abbrev.first);
-    Asm->OutStreamer->AddComment(dwarf::TagString(Tag));
-    Asm->emitULEB128(Tag);
-    for (const auto &AttrEnc : Abbrev.second) {
+    Asm->emitULEB128(Abbrev->getAbbrevTagIndex() + 1);
----------------
dwblaikie wrote:

Rename `AbbrevTagIndex` (it's confusing to have `tag` in here and `index` gets a bit confusing with other concepts of index in this code, like DW_IDX codes) to `AbbrevCode` or `AbbrevNumber` see the other comment suggesting this - and make the value the actual code (1 based, rather than zero based) so it'll be easier to debug/the number reflects what's written to the abbrev table.

https://github.com/llvm/llvm-project/pull/81200


More information about the llvm-commits mailing list