summaryrefslogtreecommitdiffstats
path: root/tools/llvm-pdbdump/BuiltinDumper.cpp
blob: d80829841f3a21393fe99555e1656c091fdf5321 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//===- BuiltinDumper.cpp ---------------------------------------- *- C++ *-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "BuiltinDumper.h"
#include "LinePrinter.h"
#include "llvm-pdbdump.h"

#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"

using namespace llvm;

BuiltinDumper::BuiltinDumper(LinePrinter &P)
    : PDBSymDumper(false), Printer(P) {}

void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) {
  PDB_BuiltinType Type = Symbol.getBuiltinType();
  switch (Type) {
  case PDB_BuiltinType::Float:
    if (Symbol.getLength() == 4)
      WithColor(Printer, PDB_ColorItem::Type).get() << "float";
    else
      WithColor(Printer, PDB_ColorItem::Type).get() << "double";
    break;
  case PDB_BuiltinType::UInt:
    WithColor(Printer, PDB_ColorItem::Type).get() << "unsigned";
    if (Symbol.getLength() == 8)
      WithColor(Printer, PDB_ColorItem::Type).get() << " __int64";
    break;
  case PDB_BuiltinType::Int:
    if (Symbol.getLength() == 4)
      WithColor(Printer, PDB_ColorItem::Type).get() << "int";
    else
      WithColor(Printer, PDB_ColorItem::Type).get() << "__int64";
    break;
  case PDB_BuiltinType::Char:
    WithColor(Printer, PDB_ColorItem::Type).get() << "char";
    break;
  case PDB_BuiltinType::WCharT:
    WithColor(Printer, PDB_ColorItem::Type).get() << "wchar_t";
    break;
  case PDB_BuiltinType::Void:
    WithColor(Printer, PDB_ColorItem::Type).get() << "void";
    break;
  case PDB_BuiltinType::Long:
    WithColor(Printer, PDB_ColorItem::Type).get() << "long";
    break;
  case PDB_BuiltinType::ULong:
    WithColor(Printer, PDB_ColorItem::Type).get() << "unsigned long";
    break;
  case PDB_BuiltinType::Bool:
    WithColor(Printer, PDB_ColorItem::Type).get() << "bool";
    break;
  case PDB_BuiltinType::Currency:
    WithColor(Printer, PDB_ColorItem::Type).get() << "CURRENCY";
    break;
  case PDB_BuiltinType::Date:
    WithColor(Printer, PDB_ColorItem::Type).get() << "DATE";
    break;
  case PDB_BuiltinType::Variant:
    WithColor(Printer, PDB_ColorItem::Type).get() << "VARIANT";
    break;
  case PDB_BuiltinType::Complex:
    WithColor(Printer, PDB_ColorItem::Type).get() << "complex";
    break;
  case PDB_BuiltinType::Bitfield:
    WithColor(Printer, PDB_ColorItem::Type).get() << "bitfield";
    break;
  case PDB_BuiltinType::BSTR:
    WithColor(Printer, PDB_ColorItem::Type).get() << "BSTR";
    break;
  case PDB_BuiltinType::HResult:
    WithColor(Printer, PDB_ColorItem::Type).get() << "HRESULT";
    break;
  case PDB_BuiltinType::BCD:
    WithColor(Printer, PDB_ColorItem::Type).get() << "HRESULT";
    break;
  default:
    WithColor(Printer, PDB_ColorItem::Type).get() << "void";
    break;
  }
}