#include "BuiltinDumper.h"
#include "FunctionDumper.h"
+#include "LinePrinter.h"
#include "llvm-pdbdump.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
using namespace llvm;
-TypedefDumper::TypedefDumper() : PDBSymDumper(true) {}
+TypedefDumper::TypedefDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
void TypedefDumper::start(const PDBSymbolTypeTypedef &Symbol, raw_ostream &OS,
int Indent) {
- OS << "typedef ";
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "typedef ";
uint32_t TargetId = Symbol.getTypeId();
if (auto TypeSymbol = Symbol.getSession().getSymbolById(TargetId))
TypeSymbol->dump(OS, 0, *this);
- OS << " " << Symbol.getName();
+ WithColor(Printer, PDB_ColorItem::Type).get() << " " << Symbol.getName();
}
void TypedefDumper::dump(const PDBSymbolTypeArray &Symbol, raw_ostream &OS,
void TypedefDumper::dump(const PDBSymbolTypeBuiltin &Symbol, raw_ostream &OS,
int Indent) {
- BuiltinDumper Dumper;
+ BuiltinDumper Dumper(Printer);
Dumper.start(Symbol, OS);
}
void TypedefDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS,
int Indent) {
- OS << "enum " << Symbol.getName();
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << " " << Symbol.getName();
}
void TypedefDumper::dump(const PDBSymbolTypePointer &Symbol, raw_ostream &OS,
int Indent) {
if (Symbol.isConstType())
- OS << "const ";
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
if (Symbol.isVolatileType())
- OS << "volatile ";
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
uint32_t PointeeId = Symbol.getTypeId();
auto PointeeType = Symbol.getSession().getSymbolById(PointeeId);
if (!PointeeType)
FunctionDumper::PointerType Pointer = FunctionDumper::PointerType::Pointer;
if (Symbol.isReference())
Pointer = FunctionDumper::PointerType::Reference;
- FunctionDumper NestedDumper;
+ FunctionDumper NestedDumper(Printer);
NestedDumper.start(*FuncSig, nullptr, Pointer, OS);
} else {
PointeeType->dump(OS, Indent, *this);
void TypedefDumper::dump(const PDBSymbolTypeFunctionSig &Symbol,
raw_ostream &OS, int Indent) {
- FunctionDumper Dumper;
+ FunctionDumper Dumper(Printer);
Dumper.start(Symbol, nullptr, FunctionDumper::PointerType::None, OS);
}
void TypedefDumper::dump(const PDBSymbolTypeUDT &Symbol, raw_ostream &OS,
int Indent) {
- OS << "class " << Symbol.getName();
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << " " << Symbol.getName();
}