diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h @@ -14,6 +14,7 @@ #include "llvm/DebugInfo/DWARF/DWARFDie.h" #include +#include namespace llvm { @@ -25,6 +26,7 @@ raw_ostream &OS; bool Word = true; bool EndedWithTemplate = false; + static std::unordered_set ScopelessDIEs; DWARFTypePrinter(raw_ostream &OS) : OS(OS) {} diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp @@ -4,6 +4,9 @@ #include "llvm/Support/ScopedPrinter.h" namespace llvm { using namespace dwarf; +std::unordered_set DWARFTypePrinter::ScopelessDIEs = { + dwarf::DW_TAG_pointer_type}; + void DWARFTypePrinter::appendTypeTagName(dwarf::Tag T) { StringRef TagStr = TagString(T); static constexpr StringRef Prefix = "DW_TAG_"; @@ -283,8 +286,9 @@ } void DWARFTypePrinter::appendQualifiedName(DWARFDie D) { - if (D) + if (D && !ScopelessDIEs.count(D.getTag())) appendScopes(D.getParent()); + appendUnqualifiedName(D); } DWARFDie DWARFTypePrinter::appendQualifiedNameBefore(DWARFDie D) {