Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 1 | //===- FunctionDumper.cpp ------------------------------------ *- C++ *-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "FunctionDumper.h" |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 11 | #include "BuiltinDumper.h" |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 12 | #include "LinePrinter.h" |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 13 | #include "llvm-pdbdump.h" |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 14 | |
| 15 | #include "llvm/DebugInfo/PDB/IPDBSession.h" |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 16 | #include "llvm/DebugInfo/PDB/PDBSymbolData.h" |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 17 | #include "llvm/DebugInfo/PDB/PDBSymbolFunc.h" |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 18 | #include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h" |
| 19 | #include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h" |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 20 | #include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h" |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 21 | #include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h" |
| 22 | #include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h" |
| 23 | #include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h" |
| 24 | #include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h" |
| 25 | #include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h" |
| 26 | #include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h" |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 27 | #include "llvm/Support/Format.h" |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 28 | |
Zachary Turner | aea5992 | 2015-02-22 22:20:26 +0000 | [diff] [blame] | 29 | using namespace llvm; |
| 30 | |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 31 | namespace { |
| 32 | template <class T> |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 33 | void dumpClassParentWithScopeOperator(const T &Symbol, LinePrinter &Printer, |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 34 | llvm::FunctionDumper &Dumper) { |
| 35 | uint32_t ClassParentId = Symbol.getClassParentId(); |
| 36 | auto ClassParent = |
David Majnemer | 3f45d40 | 2015-02-22 22:33:57 +0000 | [diff] [blame] | 37 | Symbol.getSession().template getConcreteSymbolById<PDBSymbolTypeUDT>( |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 38 | ClassParentId); |
| 39 | if (!ClassParent) |
| 40 | return; |
| 41 | |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 42 | WithColor(Printer, PDB_ColorItem::Type).get() << ClassParent->getName(); |
| 43 | Printer << "::"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 44 | } |
| 45 | } |
| 46 | |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 47 | FunctionDumper::FunctionDumper(LinePrinter &P) |
| 48 | : PDBSymDumper(true), Printer(P) {} |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 49 | |
| 50 | void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol, |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 51 | const char *Name, PointerType Pointer, |
| 52 | raw_ostream &OS) { |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 53 | auto ReturnType = Symbol.getReturnType(); |
| 54 | ReturnType->dump(OS, 0, *this); |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 55 | Printer << " "; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 56 | uint32_t ClassParentId = Symbol.getClassParentId(); |
| 57 | auto ClassParent = |
| 58 | Symbol.getSession().getConcreteSymbolById<PDBSymbolTypeUDT>( |
| 59 | ClassParentId); |
| 60 | |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 61 | PDB_CallingConv CC = Symbol.getCallingConvention(); |
| 62 | bool ShouldDumpCallingConvention = true; |
| 63 | if ((ClassParent && CC == PDB_CallingConv::Thiscall) || |
| 64 | (!ClassParent && CC == PDB_CallingConv::NearStdcall)) { |
| 65 | ShouldDumpCallingConvention = false; |
| 66 | } |
| 67 | |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 68 | if (Pointer == PointerType::None) { |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 69 | if (ShouldDumpCallingConvention) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 70 | WithColor(Printer, PDB_ColorItem::Keyword).get() << CC << " "; |
| 71 | if (ClassParent) { |
| 72 | Printer << "("; |
| 73 | WithColor(Printer, PDB_ColorItem::Identifier).get() |
| 74 | << ClassParent->getName(); |
| 75 | Printer << "::)"; |
| 76 | } |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 77 | } else { |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 78 | Printer << "("; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 79 | if (ShouldDumpCallingConvention) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 80 | WithColor(Printer, PDB_ColorItem::Keyword).get() << CC << " "; |
| 81 | if (ClassParent) { |
| 82 | WithColor(Printer, PDB_ColorItem::Identifier).get() |
| 83 | << ClassParent->getName(); |
| 84 | Printer << "::"; |
| 85 | } |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 86 | if (Pointer == PointerType::Reference) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 87 | Printer << "&"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 88 | else |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 89 | Printer << "*"; |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 90 | if (Name) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 91 | WithColor(Printer, PDB_ColorItem::Identifier).get() << Name; |
| 92 | Printer << ")"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 93 | } |
| 94 | |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 95 | Printer << "("; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 96 | if (auto ChildEnum = Symbol.getArguments()) { |
| 97 | uint32_t Index = 0; |
| 98 | while (auto Arg = ChildEnum->getNext()) { |
| 99 | Arg->dump(OS, 0, *this); |
| 100 | if (++Index < ChildEnum->getChildCount()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 101 | Printer << ", "; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 102 | } |
| 103 | } |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 104 | Printer << ")"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 105 | |
| 106 | if (Symbol.isConstType()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 107 | WithColor(Printer, PDB_ColorItem::Keyword).get() << " const"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 108 | if (Symbol.isVolatileType()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 109 | WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 112 | void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer, |
| 113 | raw_ostream &OS, int Indent) { |
| 114 | uint32_t FuncStart = Symbol.getRelativeVirtualAddress(); |
| 115 | uint32_t FuncEnd = FuncStart + Symbol.getLength(); |
| 116 | |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 117 | Printer << "func "; |
| 118 | WithColor(Printer, PDB_ColorItem::Address).get() << "[" |
| 119 | << format_hex(FuncStart, 8); |
| 120 | if (auto DebugStart = Symbol.findOneChild<PDBSymbolFuncDebugStart>()) { |
| 121 | uint32_t Prologue = DebugStart->getRelativeVirtualAddress() - FuncStart; |
| 122 | WithColor(Printer, PDB_ColorItem::Offset).get() << "+" << Prologue; |
| 123 | } |
| 124 | WithColor(Printer, PDB_ColorItem::Address).get() << " - " |
| 125 | << format_hex(FuncEnd, 8); |
| 126 | if (auto DebugEnd = Symbol.findOneChild<PDBSymbolFuncDebugEnd>()) { |
| 127 | uint32_t Epilogue = FuncEnd - DebugEnd->getRelativeVirtualAddress(); |
| 128 | WithColor(Printer, PDB_ColorItem::Offset).get() << "-" << Epilogue; |
| 129 | } |
| 130 | WithColor(Printer, PDB_ColorItem::Address).get() << "] "; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 131 | |
| 132 | if (Symbol.hasFramePointer()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 133 | WithColor(Printer, PDB_ColorItem::Address).get() |
| 134 | << "(" << Symbol.getLocalBasePointerRegisterId() << ")"; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 135 | else |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 136 | WithColor(Printer, PDB_ColorItem::Address).get() << "(FPO)"; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 137 | |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 138 | Printer << " "; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 139 | if (Symbol.isVirtual() || Symbol.isPureVirtual()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 140 | WithColor(Printer, PDB_ColorItem::Keyword).get() << "virtual "; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 141 | |
| 142 | auto Signature = Symbol.getSignature(); |
| 143 | if (!Signature) { |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 144 | WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName(); |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 145 | if (Pointer == PointerType::Pointer) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 146 | Printer << "*"; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 147 | else if (Pointer == FunctionDumper::PointerType::Reference) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 148 | Printer << "&"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 149 | return; |
| 150 | } |
| 151 | |
| 152 | auto ReturnType = Signature->getReturnType(); |
| 153 | ReturnType->dump(OS, 0, *this); |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 154 | Printer << " "; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 155 | |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 156 | auto ClassParent = Symbol.getClassParent(); |
| 157 | PDB_CallingConv CC = Signature->getCallingConvention(); |
| 158 | if (Pointer != FunctionDumper::PointerType::None) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 159 | Printer << "("; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 160 | |
| 161 | if ((ClassParent && CC != PDB_CallingConv::Thiscall) || |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 162 | (!ClassParent && CC != PDB_CallingConv::NearStdcall)) { |
| 163 | WithColor(Printer, PDB_ColorItem::Keyword).get() |
| 164 | << Signature->getCallingConvention() << " "; |
| 165 | } |
| 166 | WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName(); |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 167 | if (Pointer != FunctionDumper::PointerType::None) { |
| 168 | if (Pointer == PointerType::Pointer) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 169 | Printer << "*"; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 170 | else if (Pointer == FunctionDumper::PointerType::Reference) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 171 | Printer << "&"; |
| 172 | Printer << ")"; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 173 | } |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 174 | |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 175 | Printer << "("; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 176 | if (auto Arguments = Symbol.getArguments()) { |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 177 | uint32_t Index = 0; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 178 | while (auto Arg = Arguments->getNext()) { |
| 179 | auto ArgType = Arg->getType(); |
| 180 | ArgType->dump(OS, 0, *this); |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 181 | WithColor(Printer, PDB_ColorItem::Identifier).get() << " " |
| 182 | << Arg->getName(); |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 183 | if (++Index < Arguments->getChildCount()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 184 | Printer << ", "; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 185 | } |
| 186 | } |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 187 | Printer << ")"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 188 | if (Symbol.isConstType()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 189 | WithColor(Printer, PDB_ColorItem::Keyword).get() << " const"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 190 | if (Symbol.isVolatileType()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 191 | WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 192 | if (Symbol.isPureVirtual()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 193 | Printer << " = 0"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | void FunctionDumper::dump(const PDBSymbolTypeArray &Symbol, raw_ostream &OS, |
| 197 | int Indent) { |
| 198 | uint32_t ElementTypeId = Symbol.getTypeId(); |
| 199 | auto ElementType = Symbol.getSession().getSymbolById(ElementTypeId); |
| 200 | if (!ElementType) |
| 201 | return; |
| 202 | |
| 203 | ElementType->dump(OS, 0, *this); |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 204 | Printer << "["; |
| 205 | WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Symbol.getLength(); |
| 206 | Printer << "]"; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | void FunctionDumper::dump(const PDBSymbolTypeBuiltin &Symbol, raw_ostream &OS, |
| 210 | int Indent) { |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 211 | BuiltinDumper Dumper(Printer); |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 212 | Dumper.start(Symbol, OS); |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | void FunctionDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS, |
| 216 | int Indent) { |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 217 | dumpClassParentWithScopeOperator(Symbol, Printer, *this); |
| 218 | WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName(); |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | void FunctionDumper::dump(const PDBSymbolTypeFunctionArg &Symbol, |
| 222 | raw_ostream &OS, int Indent) { |
| 223 | // PDBSymbolTypeFunctionArg is just a shim over the real argument. Just drill |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 224 | // through to the real thing and dump it. |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 225 | uint32_t TypeId = Symbol.getTypeId(); |
| 226 | auto Type = Symbol.getSession().getSymbolById(TypeId); |
| 227 | if (!Type) |
| 228 | return; |
| 229 | Type->dump(OS, 0, *this); |
| 230 | } |
| 231 | |
| 232 | void FunctionDumper::dump(const PDBSymbolTypeTypedef &Symbol, raw_ostream &OS, |
| 233 | int Indent) { |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 234 | dumpClassParentWithScopeOperator(Symbol, Printer, *this); |
| 235 | WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName(); |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | void FunctionDumper::dump(const PDBSymbolTypePointer &Symbol, raw_ostream &OS, |
| 239 | int Indent) { |
| 240 | uint32_t PointeeId = Symbol.getTypeId(); |
| 241 | auto PointeeType = Symbol.getSession().getSymbolById(PointeeId); |
| 242 | if (!PointeeType) |
| 243 | return; |
| 244 | |
| 245 | if (auto FuncSig = dyn_cast<PDBSymbolTypeFunctionSig>(PointeeType.get())) { |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 246 | FunctionDumper NestedDumper(Printer); |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 247 | PointerType Pointer = |
| 248 | Symbol.isReference() ? PointerType::Reference : PointerType::Pointer; |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 249 | NestedDumper.start(*FuncSig, nullptr, Pointer, OS); |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 250 | } else { |
| 251 | if (Symbol.isConstType()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 252 | WithColor(Printer, PDB_ColorItem::Keyword).get() << "const "; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 253 | if (Symbol.isVolatileType()) |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 254 | WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile "; |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 255 | PointeeType->dump(OS, Indent, *this); |
| 256 | OS << (Symbol.isReference() ? "&" : "*"); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | void FunctionDumper::dump(const PDBSymbolTypeUDT &Symbol, raw_ostream &OS, |
| 261 | int Indent) { |
Zachary Turner | 2d11c20 | 2015-02-27 09:15:59 +0000 | [diff] [blame^] | 262 | WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName(); |
Zachary Turner | 9a818ad | 2015-02-22 22:03:38 +0000 | [diff] [blame] | 263 | } |