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