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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 08:05:31 PST 2024


================
@@ -360,6 +360,47 @@ class DWARF5AccelTable : public AccelTable<DWARF5AccelTableData> {
     unsigned Index;
     DWARF5AccelTableData::AttributeEncoding Encoding;
   };
+
+  struct AbbrevDescriptor {
+    uint32_t CompUnit : 1;
+    uint32_t TypeUnit : 1;
+    uint32_t DieOffset : 1;
+    uint32_t Parent : 2;
+    uint32_t TypeHash : 1;
+    uint32_t Tag : 26;
+  };
+  struct TagIndex {
+    uint32_t DieTag;
+    uint32_t Index;
+  };
+  struct cmpByTagIndex {
+    bool operator()(const TagIndex &LHS, const TagIndex &RHS) const {
+      return LHS.Index < RHS.Index;
+    }
+  };
+  enum IdxParentEncoding : uint8_t {
+    NoIndexedParent =
+        0,        /// Parent information present but parent isn't indexed.
+    Ref4 = 1,     /// Parent information present and parent is indexed.
+    NoParent = 2, /// Parent information missing.
+  };
+
+  /// Returns DW_IDX_parent abbrev encoding for the given form.
+  static uint8_t
+  encodeIdxParent(const std::optional<dwarf::Form> MaybeParentForm) {
----------------
dwblaikie wrote:

LLVM code, by and large, does not use `const` on values - please don't do this. It's confusing to read in a codebase that doesn't usually do it as it may be mistaken for a missing `&` even when that's not the intent.

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


More information about the llvm-commits mailing list