BuiltinDumper.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //===- BuiltinDumper.cpp ---------------------------------------- *- C++ *-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #include "BuiltinDumper.h"
  10. #include "LinePrinter.h"
  11. #include "llvm-pdbdump.h"
  12. #include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
  13. using namespace llvm;
  14. BuiltinDumper::BuiltinDumper(LinePrinter &P)
  15. : PDBSymDumper(false), Printer(P) {}
  16. void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) {
  17. PDB_BuiltinType Type = Symbol.getBuiltinType();
  18. switch (Type) {
  19. case PDB_BuiltinType::Float:
  20. if (Symbol.getLength() == 4)
  21. WithColor(Printer, PDB_ColorItem::Type).get() << "float";
  22. else
  23. WithColor(Printer, PDB_ColorItem::Type).get() << "double";
  24. break;
  25. case PDB_BuiltinType::UInt:
  26. WithColor(Printer, PDB_ColorItem::Type).get() << "unsigned";
  27. if (Symbol.getLength() == 8)
  28. WithColor(Printer, PDB_ColorItem::Type).get() << " __int64";
  29. break;
  30. case PDB_BuiltinType::Int:
  31. if (Symbol.getLength() == 4)
  32. WithColor(Printer, PDB_ColorItem::Type).get() << "int";
  33. else
  34. WithColor(Printer, PDB_ColorItem::Type).get() << "__int64";
  35. break;
  36. case PDB_BuiltinType::Char:
  37. WithColor(Printer, PDB_ColorItem::Type).get() << "char";
  38. break;
  39. case PDB_BuiltinType::WCharT:
  40. WithColor(Printer, PDB_ColorItem::Type).get() << "wchar_t";
  41. break;
  42. case PDB_BuiltinType::Void:
  43. WithColor(Printer, PDB_ColorItem::Type).get() << "void";
  44. break;
  45. case PDB_BuiltinType::Long:
  46. WithColor(Printer, PDB_ColorItem::Type).get() << "long";
  47. break;
  48. case PDB_BuiltinType::ULong:
  49. WithColor(Printer, PDB_ColorItem::Type).get() << "unsigned long";
  50. break;
  51. case PDB_BuiltinType::Bool:
  52. WithColor(Printer, PDB_ColorItem::Type).get() << "bool";
  53. break;
  54. case PDB_BuiltinType::Currency:
  55. WithColor(Printer, PDB_ColorItem::Type).get() << "CURRENCY";
  56. break;
  57. case PDB_BuiltinType::Date:
  58. WithColor(Printer, PDB_ColorItem::Type).get() << "DATE";
  59. break;
  60. case PDB_BuiltinType::Variant:
  61. WithColor(Printer, PDB_ColorItem::Type).get() << "VARIANT";
  62. break;
  63. case PDB_BuiltinType::Complex:
  64. WithColor(Printer, PDB_ColorItem::Type).get() << "complex";
  65. break;
  66. case PDB_BuiltinType::Bitfield:
  67. WithColor(Printer, PDB_ColorItem::Type).get() << "bitfield";
  68. break;
  69. case PDB_BuiltinType::BSTR:
  70. WithColor(Printer, PDB_ColorItem::Type).get() << "BSTR";
  71. break;
  72. case PDB_BuiltinType::HResult:
  73. WithColor(Printer, PDB_ColorItem::Type).get() << "HRESULT";
  74. break;
  75. case PDB_BuiltinType::BCD:
  76. WithColor(Printer, PDB_ColorItem::Type).get() << "HRESULT";
  77. break;
  78. default:
  79. WithColor(Printer, PDB_ColorItem::Type).get() << "void";
  80. break;
  81. }
  82. }