SymbolDumper.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- SymbolDumper.h - CodeView symbol info dumper ------------*- 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. #ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H
  14. #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H
  15. #include "llvm/DebugInfo/CodeView/CVRecord.h"
  16. #include "llvm/DebugInfo/CodeView/CodeView.h"
  17. #include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
  18. #include "llvm/Support/Error.h"
  19. #include <memory>
  20. #include <utility>
  21. namespace llvm {
  22. class ScopedPrinter;
  23. namespace codeview {
  24. class TypeCollection;
  25. /// Dumper for CodeView symbol streams found in COFF object files and PDB files.
  26. class CVSymbolDumper {
  27. public:
  28. CVSymbolDumper(ScopedPrinter &W, TypeCollection &Types,
  29. CodeViewContainer Container,
  30. std::unique_ptr<SymbolDumpDelegate> ObjDelegate, CPUType CPU,
  31. bool PrintRecordBytes)
  32. : W(W), Types(Types), Container(Container),
  33. ObjDelegate(std::move(ObjDelegate)), CompilationCPUType(CPU),
  34. PrintRecordBytes(PrintRecordBytes) {}
  35. /// Dumps one type record. Returns false if there was a type parsing error,
  36. /// and true otherwise. This should be called in order, since the dumper
  37. /// maintains state about previous records which are necessary for cross
  38. /// type references.
  39. Error dump(CVRecord<SymbolKind> &Record);
  40. /// Dumps the type records in Data. Returns false if there was a type stream
  41. /// parse error, and true otherwise.
  42. Error dump(const CVSymbolArray &Symbols);
  43. CPUType getCompilationCPUType() const { return CompilationCPUType; }
  44. private:
  45. ScopedPrinter &W;
  46. TypeCollection &Types;
  47. CodeViewContainer Container;
  48. std::unique_ptr<SymbolDumpDelegate> ObjDelegate;
  49. CPUType CompilationCPUType;
  50. bool PrintRecordBytes;
  51. };
  52. } // end namespace codeview
  53. } // end namespace llvm
  54. #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H
  55. #ifdef __GNUC__
  56. #pragma GCC diagnostic pop
  57. #endif