2017-01-11 01:35:43 +01:00
|
|
|
//===- PrettyBuiltinDumper.cpp ---------------------------------- *- C++ *-===//
|
2015-02-27 00:51:49 +01:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-01-11 01:35:43 +01:00
|
|
|
#include "PrettyBuiltinDumper.h"
|
2015-02-27 10:15:59 +01:00
|
|
|
#include "LinePrinter.h"
|
2015-02-27 00:51:49 +01:00
|
|
|
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
2016-05-04 22:32:13 +02:00
|
|
|
using namespace llvm::pdb;
|
2015-02-27 00:51:49 +01:00
|
|
|
|
2015-02-27 10:15:59 +01:00
|
|
|
BuiltinDumper::BuiltinDumper(LinePrinter &P)
|
|
|
|
: PDBSymDumper(false), Printer(P) {}
|
2015-02-27 00:51:49 +01:00
|
|
|
|
2015-03-01 07:51:29 +01:00
|
|
|
void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) {
|
2017-04-10 18:43:09 +02:00
|
|
|
if (Symbol.isConstType())
|
|
|
|
WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
|
|
|
|
if (Symbol.isVolatileType())
|
|
|
|
WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
|
2015-11-03 21:16:18 +01:00
|
|
|
WithColor(Printer, PDB_ColorItem::Type).get() << getTypeName(Symbol);
|
|
|
|
}
|
|
|
|
|
|
|
|
StringRef BuiltinDumper::getTypeName(const PDBSymbolTypeBuiltin &Symbol) {
|
2015-02-27 00:51:49 +01:00
|
|
|
PDB_BuiltinType Type = Symbol.getBuiltinType();
|
|
|
|
switch (Type) {
|
|
|
|
case PDB_BuiltinType::Float:
|
2015-02-27 10:15:59 +01:00
|
|
|
if (Symbol.getLength() == 4)
|
2015-11-03 21:16:18 +01:00
|
|
|
return "float";
|
|
|
|
return "double";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::UInt:
|
2016-04-11 22:39:17 +02:00
|
|
|
switch (Symbol.getLength()) {
|
|
|
|
case 8:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "unsigned __int64";
|
2016-04-11 22:39:17 +02:00
|
|
|
case 4:
|
|
|
|
return "unsigned int";
|
|
|
|
case 2:
|
|
|
|
return "unsigned short";
|
|
|
|
case 1:
|
|
|
|
return "unsigned char";
|
|
|
|
default:
|
|
|
|
return "unsigned";
|
|
|
|
}
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Int:
|
2016-04-11 22:39:17 +02:00
|
|
|
switch (Symbol.getLength()) {
|
|
|
|
case 8:
|
|
|
|
return "__int64";
|
|
|
|
case 4:
|
|
|
|
return "int";
|
|
|
|
case 2:
|
|
|
|
return "short";
|
|
|
|
case 1:
|
|
|
|
return "char";
|
|
|
|
default:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "int";
|
2016-04-11 22:39:17 +02:00
|
|
|
}
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Char:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "char";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::WCharT:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "wchar_t";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Void:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "void";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Long:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "long";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::ULong:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "unsigned long";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Bool:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "bool";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Currency:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "CURRENCY";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Date:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "DATE";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Variant:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "VARIANT";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Complex:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "complex";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::Bitfield:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "bitfield";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::BSTR:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "BSTR";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::HResult:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "HRESULT";
|
2015-02-27 00:51:49 +01:00
|
|
|
case PDB_BuiltinType::BCD:
|
2015-11-03 21:16:18 +01:00
|
|
|
return "HRESULT";
|
2018-02-23 00:16:56 +01:00
|
|
|
case PDB_BuiltinType::Char16:
|
|
|
|
return "char16_t";
|
|
|
|
case PDB_BuiltinType::Char32:
|
|
|
|
return "char32_t";
|
2018-01-17 02:22:03 +01:00
|
|
|
case PDB_BuiltinType::None:
|
|
|
|
return "...";
|
2015-02-27 00:51:49 +01:00
|
|
|
}
|
2018-01-17 19:16:28 +01:00
|
|
|
llvm_unreachable("Unknown PDB_BuiltinType");
|
2015-02-27 00:51:49 +01:00
|
|
|
}
|