Skip to content

Commit 7b9fcf5

Browse files
authored
[DWARF] Teach getAttributeValueAsReferencedDie to resolve DW_FORM_ref… (llvm#101197)
…_sig8 Splitting from llvm#99495. I've extended the type unit test case to feature more kinds of references, including the gcc-style DW_AT_type[DW_FORM_ref_sig8] reference, which this patch fixes.
1 parent 04f6504 commit 7b9fcf5

File tree

2 files changed

+245
-375
lines changed

2 files changed

+245
-375
lines changed

llvm/lib/DebugInfo/DWARF/DWARFDie.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ DWARFDie::getAttributeValueAsReferencedDie(const DWARFFormValue &V) const {
319319
} else if (Offset = V.getAsDebugInfoReference(); Offset) {
320320
if (DWARFUnit *SpecUnit = U->getUnitVector().getUnitForOffset(*Offset))
321321
Result = SpecUnit->getDIEForOffset(*Offset);
322+
} else if (std::optional<uint64_t> Sig = V.getAsSignatureReference()) {
323+
if (DWARFTypeUnit *TU = U->getContext().getTypeUnitForHash(
324+
U->getVersion(), *Sig, U->isDWOUnit()))
325+
Result = TU->getDIEForOffset(TU->getTypeOffset() + TU->getOffset());
322326
}
323327
return Result;
324328
}

0 commit comments

Comments
 (0)