[PATCH] D132900: [DWARF] Fix infinite recursion in Type Printer.
Alexander Yermolovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 16:25:12 PDT 2022
ayermolo updated this revision to Diff 459587.
ayermolo added a comment.
some cleanup
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132900/new/
https://reviews.llvm.org/D132900
Files:
llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
Index: llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
@@ -4,6 +4,9 @@
#include "llvm/Support/ScopedPrinter.h"
namespace llvm {
using namespace dwarf;
+std::unordered_set<Tag> 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) {
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
@@ -14,6 +14,7 @@
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
#include <string>
+#include <unordered_set>
namespace llvm {
@@ -25,6 +26,7 @@
raw_ostream &OS;
bool Word = true;
bool EndedWithTemplate = false;
+ static std::unordered_set<dwarf::Tag> ScopelessDIEs;
DWARFTypePrinter(raw_ostream &OS) : OS(OS) {}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132900.459587.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220912/f24a5e1f/attachment.bin>
More information about the llvm-commits
mailing list