Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// XFAIL: system-darwin
// RUN: %clang %target_itanium_abi_host_triple %p/Inputs/simplified_template_names.cpp -c -o - -gdwarf-4 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 -gtemplate-alias \
// RUN: | llvm-dwarfdump --verify -
//
Expand Down
22 changes: 19 additions & 3 deletions llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,23 @@ const char *toString(std::optional<DWARFFormValueType> F) {
}
return nullptr;
}

/// Resolve the DW_AT_type of \c D until we reach a DIE that is not a
/// DW_TAG_typedef.
template <typename DieType> DieType unwrapReferencedTypedefType(DieType D) {
auto TypeAttr = D.find(dwarf::DW_AT_type);
if (!TypeAttr)
return DieType();

auto Unwrapped = detail::resolveReferencedType(D, *TypeAttr);
if (!Unwrapped)
return DieType();

if (Unwrapped.getTag() == dwarf::DW_TAG_typedef)
return unwrapReferencedTypedefType(Unwrapped);

return Unwrapped;
}
} // namespace detail

template <typename DieType>
Expand Down Expand Up @@ -588,10 +605,9 @@ bool DWARFTypePrinter<DieType>::appendTemplateParameters(DieType D,
}
if (C.getTag() != dwarf::DW_TAG_template_type_parameter)
continue;
auto TypeAttr = C.find(dwarf::DW_AT_type);
Sep();
appendQualifiedName(TypeAttr ? detail::resolveReferencedType(C, *TypeAttr)
: DieType());

appendQualifiedName(detail::unwrapReferencedTypedefType(C));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't entirely sure if this was the right place. We could just unwrap the DIE in appendUnqualifiedNameBefore for DW_TAG_typedef. But that felt wrong (though that didn't fail any tests, so maybe we usually never get to appendUnqualifiedNameBefore for typedef types?). But still felt a bit off

}
if (IsTemplate && *FirstParameter && FirstParameter == &FirstParameterValue) {
OS << '<';
Expand Down