14c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar//===- BuiltinDumper.cpp ---------------------------------------- *- C++ *-===// 24c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar// 34c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar// The LLVM Compiler Infrastructure 44c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar// 54c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar// This file is distributed under the University of Illinois Open Source 64c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar// License. See LICENSE.TXT for details. 74c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar// 84c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar//===----------------------------------------------------------------------===// 94c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar 104c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar#include "BuiltinDumper.h" 114c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar#include "LinePrinter.h" 124c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar#include "llvm-pdbdump.h" 134c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar 144c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h" 154c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar 164c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainarusing namespace llvm; 174c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar 184c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga NainarBuiltinDumper::BuiltinDumper(LinePrinter &P) 194c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar : PDBSymDumper(false), Printer(P) {} 204c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar 214c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainarvoid BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) { 22cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar WithColor(Printer, PDB_ColorItem::Type).get() << getTypeName(Symbol); 23cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar} 24cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar 25cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga NainarStringRef BuiltinDumper::getTypeName(const PDBSymbolTypeBuiltin &Symbol) { 264c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar PDB_BuiltinType Type = Symbol.getBuiltinType(); 274c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar switch (Type) { 284c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Float: 294c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar if (Symbol.getLength() == 4) 30cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "float"; 31cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "double"; 324c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::UInt: 334c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar if (Symbol.getLength() == 8) 34cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "unsigned __int64"; 35cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "unsigned"; 364c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Int: 374c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar if (Symbol.getLength() == 4) 38cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "int"; 39cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "__int64"; 404c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Char: 41cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "char"; 424c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::WCharT: 43cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "wchar_t"; 444c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Void: 45cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "void"; 464c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Long: 47cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "long"; 484c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::ULong: 49cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "unsigned long"; 504c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Bool: 51cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "bool"; 524c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Currency: 53cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "CURRENCY"; 544c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Date: 55cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "DATE"; 564c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Variant: 57cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "VARIANT"; 584c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Complex: 59cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "complex"; 604c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::Bitfield: 61cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "bitfield"; 624c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::BSTR: 63cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "BSTR"; 644c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::HResult: 65cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "HRESULT"; 664c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar case PDB_BuiltinType::BCD: 67cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "HRESULT"; 684c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar default: 69cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar return "void"; 704c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar } 714c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar} 72