[uselistorder] Insert blank line, NFC
[oota-llvm.git] / tools / llvm-pdbdump / BuiltinDumper.cpp
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
10 #include "BuiltinDumper.h"
11 #include "LinePrinter.h"
12 #include "llvm-pdbdump.h"
13
14 #include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
15
16 using namespace llvm;
17
18 BuiltinDumper::BuiltinDumper(LinePrinter &P)
19     : PDBSymDumper(false), Printer(P) {}
20
21 void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) {
22   PDB_BuiltinType Type = Symbol.getBuiltinType();
23   switch (Type) {
24   case PDB_BuiltinType::Float:
25     if (Symbol.getLength() == 4)
26       WithColor(Printer, PDB_ColorItem::Type).get() << "float";
27     else
28       WithColor(Printer, PDB_ColorItem::Type).get() << "double";
29     break;
30   case PDB_BuiltinType::UInt:
31     WithColor(Printer, PDB_ColorItem::Type).get() << "unsigned";
32     if (Symbol.getLength() == 8)
33       WithColor(Printer, PDB_ColorItem::Type).get() << " __int64";
34     break;
35   case PDB_BuiltinType::Int:
36     if (Symbol.getLength() == 4)
37       WithColor(Printer, PDB_ColorItem::Type).get() << "int";
38     else
39       WithColor(Printer, PDB_ColorItem::Type).get() << "__int64";
40     break;
41   case PDB_BuiltinType::Char:
42     WithColor(Printer, PDB_ColorItem::Type).get() << "char";
43     break;
44   case PDB_BuiltinType::WCharT:
45     WithColor(Printer, PDB_ColorItem::Type).get() << "wchar_t";
46     break;
47   case PDB_BuiltinType::Void:
48     WithColor(Printer, PDB_ColorItem::Type).get() << "void";
49     break;
50   case PDB_BuiltinType::Long:
51     WithColor(Printer, PDB_ColorItem::Type).get() << "long";
52     break;
53   case PDB_BuiltinType::ULong:
54     WithColor(Printer, PDB_ColorItem::Type).get() << "unsigned long";
55     break;
56   case PDB_BuiltinType::Bool:
57     WithColor(Printer, PDB_ColorItem::Type).get() << "bool";
58     break;
59   case PDB_BuiltinType::Currency:
60     WithColor(Printer, PDB_ColorItem::Type).get() << "CURRENCY";
61     break;
62   case PDB_BuiltinType::Date:
63     WithColor(Printer, PDB_ColorItem::Type).get() << "DATE";
64     break;
65   case PDB_BuiltinType::Variant:
66     WithColor(Printer, PDB_ColorItem::Type).get() << "VARIANT";
67     break;
68   case PDB_BuiltinType::Complex:
69     WithColor(Printer, PDB_ColorItem::Type).get() << "complex";
70     break;
71   case PDB_BuiltinType::Bitfield:
72     WithColor(Printer, PDB_ColorItem::Type).get() << "bitfield";
73     break;
74   case PDB_BuiltinType::BSTR:
75     WithColor(Printer, PDB_ColorItem::Type).get() << "BSTR";
76     break;
77   case PDB_BuiltinType::HResult:
78     WithColor(Printer, PDB_ColorItem::Type).get() << "HRESULT";
79     break;
80   case PDB_BuiltinType::BCD:
81     WithColor(Printer, PDB_ColorItem::Type).get() << "HRESULT";
82     break;
83   default:
84     WithColor(Printer, PDB_ColorItem::Type).get() << "void";
85     break;
86   }
87 }