DIPrinter.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- llvm/DebugInfo/Symbolize/DIPrinter.h ---------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file declares the DIPrinter class, which is responsible for printing
  15. // structures defined in DebugInfo/DIContext.h
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_DEBUGINFO_SYMBOLIZE_DIPRINTER_H
  19. #define LLVM_DEBUGINFO_SYMBOLIZE_DIPRINTER_H
  20. #include <string>
  21. namespace llvm {
  22. struct DILineInfo;
  23. class DIInliningInfo;
  24. struct DIGlobal;
  25. struct DILocal;
  26. class raw_ostream;
  27. namespace symbolize {
  28. class DIPrinter {
  29. public:
  30. enum class OutputStyle { LLVM, GNU };
  31. private:
  32. raw_ostream &OS;
  33. bool PrintFunctionNames;
  34. bool PrintPretty;
  35. int PrintSourceContext;
  36. bool Verbose;
  37. OutputStyle Style;
  38. void print(const DILineInfo &Info, bool Inlined);
  39. void printContext(const std::string &FileName, int64_t Line);
  40. public:
  41. DIPrinter(raw_ostream &OS, bool PrintFunctionNames = true,
  42. bool PrintPretty = false, int PrintSourceContext = 0,
  43. bool Verbose = false, OutputStyle Style = OutputStyle::LLVM)
  44. : OS(OS), PrintFunctionNames(PrintFunctionNames),
  45. PrintPretty(PrintPretty), PrintSourceContext(PrintSourceContext),
  46. Verbose(Verbose), Style(Style) {}
  47. DIPrinter &operator<<(const DILineInfo &Info);
  48. DIPrinter &operator<<(const DIInliningInfo &Info);
  49. DIPrinter &operator<<(const DIGlobal &Global);
  50. DIPrinter &operator<<(const DILocal &Local);
  51. };
  52. }
  53. }
  54. #endif
  55. #ifdef __GNUC__
  56. #pragma GCC diagnostic pop
  57. #endif