[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:17:58 PDT 2022
ayermolo updated this revision to Diff 459586.
ayermolo added a comment.
Something like this? With other types to add that do not have scope.
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
@@ -283,8 +283,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
@@ -9,11 +9,14 @@
#ifndef LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
#define LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
+#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
+#include <cstdint>
#include <string>
+#include <unordered_set>
namespace llvm {
@@ -25,6 +28,7 @@
raw_ostream &OS;
bool Word = true;
bool EndedWithTemplate = false;
+ std::unordered_set<dwarf::Tag> ScopelessDIEs = {dwarf::DW_TAG_pointer_type};
DWARFTypePrinter(raw_ostream &OS) : OS(OS) {}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132900.459586.patch
Type: text/x-patch
Size: 1319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220912/ddaa51b5/attachment.bin>
More information about the llvm-commits
mailing list