llmv-pdbdump: Make BuiltinDumper shorter. NFC.

llvm-svn: 251974
This commit is contained in:
Rui Ueyama 2015-11-03 20:16:18 +00:00
parent d7037c56d3
commit f4acad30ec
2 changed files with 27 additions and 41 deletions

View File

@ -19,69 +19,53 @@ BuiltinDumper::BuiltinDumper(LinePrinter &P)
: PDBSymDumper(false), Printer(P) {} : PDBSymDumper(false), Printer(P) {}
void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) { void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) {
WithColor(Printer, PDB_ColorItem::Type).get() << getTypeName(Symbol);
}
StringRef BuiltinDumper::getTypeName(const PDBSymbolTypeBuiltin &Symbol) {
PDB_BuiltinType Type = Symbol.getBuiltinType(); PDB_BuiltinType Type = Symbol.getBuiltinType();
switch (Type) { switch (Type) {
case PDB_BuiltinType::Float: case PDB_BuiltinType::Float:
if (Symbol.getLength() == 4) if (Symbol.getLength() == 4)
WithColor(Printer, PDB_ColorItem::Type).get() << "float"; return "float";
else return "double";
WithColor(Printer, PDB_ColorItem::Type).get() << "double";
break;
case PDB_BuiltinType::UInt: case PDB_BuiltinType::UInt:
WithColor(Printer, PDB_ColorItem::Type).get() << "unsigned";
if (Symbol.getLength() == 8) if (Symbol.getLength() == 8)
WithColor(Printer, PDB_ColorItem::Type).get() << " __int64"; return "unsigned __int64";
break; return "unsigned";
case PDB_BuiltinType::Int: case PDB_BuiltinType::Int:
if (Symbol.getLength() == 4) if (Symbol.getLength() == 4)
WithColor(Printer, PDB_ColorItem::Type).get() << "int"; return "int";
else return "__int64";
WithColor(Printer, PDB_ColorItem::Type).get() << "__int64";
break;
case PDB_BuiltinType::Char: case PDB_BuiltinType::Char:
WithColor(Printer, PDB_ColorItem::Type).get() << "char"; return "char";
break;
case PDB_BuiltinType::WCharT: case PDB_BuiltinType::WCharT:
WithColor(Printer, PDB_ColorItem::Type).get() << "wchar_t"; return "wchar_t";
break;
case PDB_BuiltinType::Void: case PDB_BuiltinType::Void:
WithColor(Printer, PDB_ColorItem::Type).get() << "void"; return "void";
break;
case PDB_BuiltinType::Long: case PDB_BuiltinType::Long:
WithColor(Printer, PDB_ColorItem::Type).get() << "long"; return "long";
break;
case PDB_BuiltinType::ULong: case PDB_BuiltinType::ULong:
WithColor(Printer, PDB_ColorItem::Type).get() << "unsigned long"; return "unsigned long";
break;
case PDB_BuiltinType::Bool: case PDB_BuiltinType::Bool:
WithColor(Printer, PDB_ColorItem::Type).get() << "bool"; return "bool";
break;
case PDB_BuiltinType::Currency: case PDB_BuiltinType::Currency:
WithColor(Printer, PDB_ColorItem::Type).get() << "CURRENCY"; return "CURRENCY";
break;
case PDB_BuiltinType::Date: case PDB_BuiltinType::Date:
WithColor(Printer, PDB_ColorItem::Type).get() << "DATE"; return "DATE";
break;
case PDB_BuiltinType::Variant: case PDB_BuiltinType::Variant:
WithColor(Printer, PDB_ColorItem::Type).get() << "VARIANT"; return "VARIANT";
break;
case PDB_BuiltinType::Complex: case PDB_BuiltinType::Complex:
WithColor(Printer, PDB_ColorItem::Type).get() << "complex"; return "complex";
break;
case PDB_BuiltinType::Bitfield: case PDB_BuiltinType::Bitfield:
WithColor(Printer, PDB_ColorItem::Type).get() << "bitfield"; return "bitfield";
break;
case PDB_BuiltinType::BSTR: case PDB_BuiltinType::BSTR:
WithColor(Printer, PDB_ColorItem::Type).get() << "BSTR"; return "BSTR";
break;
case PDB_BuiltinType::HResult: case PDB_BuiltinType::HResult:
WithColor(Printer, PDB_ColorItem::Type).get() << "HRESULT"; return "HRESULT";
break;
case PDB_BuiltinType::BCD: case PDB_BuiltinType::BCD:
WithColor(Printer, PDB_ColorItem::Type).get() << "HRESULT"; return "HRESULT";
break;
default: default:
WithColor(Printer, PDB_ColorItem::Type).get() << "void"; return "void";
break;
} }
} }

View File

@ -23,6 +23,8 @@ public:
void start(const PDBSymbolTypeBuiltin &Symbol); void start(const PDBSymbolTypeBuiltin &Symbol);
private: private:
StringRef getTypeName(const PDBSymbolTypeBuiltin &Symbol);
LinePrinter &Printer; LinePrinter &Printer;
}; };
} }