blob: 3d7e06992182dfd3db7a61181eba9590573e9f64 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- llvm/DebugInfo/Symbolize/DIPrinter.h ---------------------*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the DIPrinter class, which is responsible for printing
10// structures defined in DebugInfo/DIContext.h
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_DEBUGINFO_SYMBOLIZE_DIPRINTER_H
15#define LLVM_DEBUGINFO_SYMBOLIZE_DIPRINTER_H
16
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020017#include <string>
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010018
19namespace llvm {
20struct DILineInfo;
21class DIInliningInfo;
22struct DIGlobal;
Andrew Walbran3d2c1972020-04-07 12:24:26 +010023struct DILocal;
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020024class raw_ostream;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010025
26namespace symbolize {
27
28class DIPrinter {
Andrew Walbran3d2c1972020-04-07 12:24:26 +010029public:
30 enum class OutputStyle { LLVM, GNU };
31
32private:
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010033 raw_ostream &OS;
34 bool PrintFunctionNames;
35 bool PrintPretty;
36 int PrintSourceContext;
37 bool Verbose;
Andrew Walbran3d2c1972020-04-07 12:24:26 +010038 OutputStyle Style;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010039
40 void print(const DILineInfo &Info, bool Inlined);
41 void printContext(const std::string &FileName, int64_t Line);
42
43public:
44 DIPrinter(raw_ostream &OS, bool PrintFunctionNames = true,
45 bool PrintPretty = false, int PrintSourceContext = 0,
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020046 bool Verbose = false, OutputStyle Style = OutputStyle::LLVM)
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010047 : OS(OS), PrintFunctionNames(PrintFunctionNames),
48 PrintPretty(PrintPretty), PrintSourceContext(PrintSourceContext),
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020049 Verbose(Verbose), Style(Style) {}
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010050
51 DIPrinter &operator<<(const DILineInfo &Info);
52 DIPrinter &operator<<(const DIInliningInfo &Info);
53 DIPrinter &operator<<(const DIGlobal &Global);
Andrew Walbran3d2c1972020-04-07 12:24:26 +010054 DIPrinter &operator<<(const DILocal &Local);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010055};
56}
57}
58
59#endif