1//===- DWARFTypePrinter.h ---------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
10#define LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
11
12#include "llvm/ADT/StringRef.h"
13#include "llvm/BinaryFormat/Dwarf.h"
14#include "llvm/DebugInfo/DWARF/DWARFDie.h"
15
16#include <string>
17
18namespace llvm {
19
20class raw_ostream;
21
22// FIXME: We should have pretty printers per language. Currently we print
23// everything as if it was C++ and fall back to the TAG type name.
24struct DWARFTypePrinter {
25 raw_ostream &OS;
26 bool Word = true;
27 bool EndedWithTemplate = false;
28
29 DWARFTypePrinter(raw_ostream &OS) : OS(OS) {}
30
31 /// Dump the name encoded in the type tag.
32 void appendTypeTagName(dwarf::Tag T);
33
34 void appendArrayType(const DWARFDie &D);
35
36 DWARFDie skipQualifiers(DWARFDie D);
37
38 bool needsParens(DWARFDie D);
39
40 void appendPointerLikeTypeBefore(DWARFDie D, DWARFDie Inner, StringRef Ptr);
41
42 DWARFDie appendUnqualifiedNameBefore(DWARFDie D,
43 std::string *OriginalFullName = nullptr);
44
45 void appendUnqualifiedNameAfter(DWARFDie D, DWARFDie Inner,
46 bool SkipFirstParamIfArtificial = false);
47 void appendQualifiedName(DWARFDie D);
48 DWARFDie appendQualifiedNameBefore(DWARFDie D);
49 bool appendTemplateParameters(DWARFDie D, bool *FirstParameter = nullptr);
50 void decomposeConstVolatile(DWARFDie &N, DWARFDie &T, DWARFDie &C,
51 DWARFDie &V);
52 void appendConstVolatileQualifierAfter(DWARFDie N);
53 void appendConstVolatileQualifierBefore(DWARFDie N);
54
55 /// Recursively append the DIE type name when applicable.
56 void appendUnqualifiedName(DWARFDie D,
57 std::string *OriginalFullName = nullptr);
58
59 void appendSubroutineNameAfter(DWARFDie D, DWARFDie Inner,
60 bool SkipFirstParamIfArtificial, bool Const,
61 bool Volatile);
62 void appendScopes(DWARFDie D);
63};
64
65} // namespace llvm
66
67#endif // LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
68

source code of llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h