Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- llvm/DebugInfo/Symbolize/DIPrinter.h ---------------------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 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 Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 17 | #include <string> |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 18 | |
| 19 | namespace llvm { |
| 20 | struct DILineInfo; |
| 21 | class DIInliningInfo; |
| 22 | struct DIGlobal; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 23 | struct DILocal; |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 24 | class raw_ostream; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 25 | |
| 26 | namespace symbolize { |
| 27 | |
| 28 | class DIPrinter { |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 29 | public: |
| 30 | enum class OutputStyle { LLVM, GNU }; |
| 31 | |
| 32 | private: |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 33 | raw_ostream &OS; |
| 34 | bool PrintFunctionNames; |
| 35 | bool PrintPretty; |
| 36 | int PrintSourceContext; |
| 37 | bool Verbose; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 38 | OutputStyle Style; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 39 | |
| 40 | void print(const DILineInfo &Info, bool Inlined); |
| 41 | void printContext(const std::string &FileName, int64_t Line); |
| 42 | |
| 43 | public: |
| 44 | DIPrinter(raw_ostream &OS, bool PrintFunctionNames = true, |
| 45 | bool PrintPretty = false, int PrintSourceContext = 0, |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 46 | bool Verbose = false, OutputStyle Style = OutputStyle::LLVM) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 47 | : OS(OS), PrintFunctionNames(PrintFunctionNames), |
| 48 | PrintPretty(PrintPretty), PrintSourceContext(PrintSourceContext), |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 49 | Verbose(Verbose), Style(Style) {} |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 50 | |
| 51 | DIPrinter &operator<<(const DILineInfo &Info); |
| 52 | DIPrinter &operator<<(const DIInliningInfo &Info); |
| 53 | DIPrinter &operator<<(const DIGlobal &Global); |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 54 | DIPrinter &operator<<(const DILocal &Local); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 55 | }; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | #endif |