2015-02-26 23:51:49 +00:00
|
|
|
//===- 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"
|
2015-02-27 09:15:59 +00:00
|
|
|
#include "LinePrinter.h"
|
2015-02-26 23:51:49 +00:00
|
|
|
#include "llvm-pdbdump.h"
|
|
|
|
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
2016-05-04 20:32:13 +00:00
|
|
|
using namespace llvm::pdb;
|
2015-02-26 23:51:49 +00:00
|
|
|
|
2015-02-27 09:15:59 +00:00
|
|
|
BuiltinDumper::BuiltinDumper(LinePrinter &P)
|
|
|
|
: PDBSymDumper(false), Printer(P) {}
|
2015-02-26 23:51:49 +00:00
|
|
|
|
2015-03-01 06:51:29 +00:00
|
|
|
void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) {
|
2015-11-03 20:16:18 +00:00
|
|
|
WithColor(Printer, PDB_ColorItem::Type).get() << getTypeName(Symbol);
|
|
|
|
}
|
|
|
|
|
|
|
|
StringRef BuiltinDumper::getTypeName(const PDBSymbolTypeBuiltin &Symbol) {
|
2015-02-26 23:51:49 +00:00
|
|
|
PDB_BuiltinType Type = Symbol.getBuiltinType();
|
|
|
|
switch (Type) {
|
|
|
|
case PDB_BuiltinType::Float:
|
2015-02-27 09:15:59 +00:00
|
|
|
if (Symbol.getLength() == 4)
|
2015-11-03 20:16:18 +00:00
|
|
|
return "float";
|
|
|
|
return "double";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::UInt:
|
2016-04-11 20:39:17 +00:00
|
|
|
switch (Symbol.getLength()) {
|
|
|
|
case 8:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "unsigned __int64";
|
2016-04-11 20:39:17 +00:00
|
|
|
case 4:
|
|
|
|
return "unsigned int";
|
|
|
|
case 2:
|
|
|
|
return "unsigned short";
|
|
|
|
case 1:
|
|
|
|
return "unsigned char";
|
|
|
|
default:
|
|
|
|
return "unsigned";
|
|
|
|
}
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Int:
|
2016-04-11 20:39:17 +00:00
|
|
|
switch (Symbol.getLength()) {
|
|
|
|
case 8:
|
|
|
|
return "__int64";
|
|
|
|
case 4:
|
|
|
|
return "int";
|
|
|
|
case 2:
|
|
|
|
return "short";
|
|
|
|
case 1:
|
|
|
|
return "char";
|
|
|
|
default:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "int";
|
2016-04-11 20:39:17 +00:00
|
|
|
}
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Char:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "char";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::WCharT:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "wchar_t";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Void:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "void";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Long:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "long";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::ULong:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "unsigned long";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Bool:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "bool";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Currency:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "CURRENCY";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Date:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "DATE";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Variant:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "VARIANT";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Complex:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "complex";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::Bitfield:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "bitfield";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::BSTR:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "BSTR";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::HResult:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "HRESULT";
|
2015-02-26 23:51:49 +00:00
|
|
|
case PDB_BuiltinType::BCD:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "HRESULT";
|
2015-02-26 23:51:49 +00:00
|
|
|
default:
|
2015-11-03 20:16:18 +00:00
|
|
|
return "void";
|
2015-02-26 23:51:49 +00:00
|
|
|
}
|
|
|
|
}
|