[llvm] [AsmPrinter][DebugNames] Implement DW_IDX_parent entries (PR #77457)

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 08:10:38 PST 2024


================
@@ -395,36 +401,92 @@ void Dwarf5AccelTableWriter::Header::emit(Dwarf5AccelTableWriter &Ctx) {
   Asm->OutStreamer->emitBytes({AugmentationString, AugmentationStringSize});
 }
 
-static uint32_t constexpr LowerBitSize = dwarf::DW_IDX_type_hash;
+std::optional<uint64_t>
+DWARF5AccelTableData::getDefiningParentDieOffset(const DIE &Die) {
+  auto *Parent = Die.getParent();
+  if (!Parent)
+    return {};
+  if (Parent->findAttribute(dwarf::Attribute::DW_AT_declaration))
+    return {};
+  return Parent->getOffset();
----------------
JDevlieghere wrote:

Why not
```
if (auto *Parent = Die.getParent()) 
  if (Parent->findAttribute(dwarf::Attribute::DW_AT_declaration))
    return Parent->getOffset();
return {};
```

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


More information about the llvm-commits mailing list