Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- TypeDumpVisitor.cpp - CodeView type info dumper ----------*- C++-*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
10
11
#include "llvm/ADT/SmallString.h"
12
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
13
#include "llvm/DebugInfo/CodeView/Formatters.h"
14
#include "llvm/DebugInfo/CodeView/TypeCollection.h"
15
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
16
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
17
#include "llvm/Support/FormatVariadic.h"
18
#include "llvm/Support/ScopedPrinter.h"
19
20
using namespace llvm;
21
using namespace llvm::codeview;
22
23
static const EnumEntry<TypeLeafKind> LeafTypeNames[] = {
24
#define CV_TYPE(enum, val) {#enum, enum},
25
#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
26
};
27
28
#define ENUM_ENTRY(enum_class, enum)                                           \
29
  { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) }
30
31
static const EnumEntry<uint16_t> ClassOptionNames[] = {
32
    ENUM_ENTRY(ClassOptions, Packed),
33
    ENUM_ENTRY(ClassOptions, HasConstructorOrDestructor),
34
    ENUM_ENTRY(ClassOptions, HasOverloadedOperator),
35
    ENUM_ENTRY(ClassOptions, Nested),
36
    ENUM_ENTRY(ClassOptions, ContainsNestedClass),
37
    ENUM_ENTRY(ClassOptions, HasOverloadedAssignmentOperator),
38
    ENUM_ENTRY(ClassOptions, HasConversionOperator),
39
    ENUM_ENTRY(ClassOptions, ForwardReference),
40
    ENUM_ENTRY(ClassOptions, Scoped),
41
    ENUM_ENTRY(ClassOptions, HasUniqueName),
42
    ENUM_ENTRY(ClassOptions, Sealed),
43
    ENUM_ENTRY(ClassOptions, Intrinsic),
44
};
45
46
static const EnumEntry<uint8_t> MemberAccessNames[] = {
47
    ENUM_ENTRY(MemberAccess, None), ENUM_ENTRY(MemberAccess, Private),
48
    ENUM_ENTRY(MemberAccess, Protected), ENUM_ENTRY(MemberAccess, Public),
49
};
50
51
static const EnumEntry<uint16_t> MethodOptionNames[] = {
52
    ENUM_ENTRY(MethodOptions, Pseudo),
53
    ENUM_ENTRY(MethodOptions, NoInherit),
54
    ENUM_ENTRY(MethodOptions, NoConstruct),
55
    ENUM_ENTRY(MethodOptions, CompilerGenerated),
56
    ENUM_ENTRY(MethodOptions, Sealed),
57
};
58
59
static const EnumEntry<uint16_t> MemberKindNames[] = {
60
    ENUM_ENTRY(MethodKind, Vanilla),
61
    ENUM_ENTRY(MethodKind, Virtual),
62
    ENUM_ENTRY(MethodKind, Static),
63
    ENUM_ENTRY(MethodKind, Friend),
64
    ENUM_ENTRY(MethodKind, IntroducingVirtual),
65
    ENUM_ENTRY(MethodKind, PureVirtual),
66
    ENUM_ENTRY(MethodKind, PureIntroducingVirtual),
67
};
68
69
static const EnumEntry<uint8_t> PtrKindNames[] = {
70
    ENUM_ENTRY(PointerKind, Near16),
71
    ENUM_ENTRY(PointerKind, Far16),
72
    ENUM_ENTRY(PointerKind, Huge16),
73
    ENUM_ENTRY(PointerKind, BasedOnSegment),
74
    ENUM_ENTRY(PointerKind, BasedOnValue),
75
    ENUM_ENTRY(PointerKind, BasedOnSegmentValue),
76
    ENUM_ENTRY(PointerKind, BasedOnAddress),
77
    ENUM_ENTRY(PointerKind, BasedOnSegmentAddress),
78
    ENUM_ENTRY(PointerKind, BasedOnType),
79
    ENUM_ENTRY(PointerKind, BasedOnSelf),
80
    ENUM_ENTRY(PointerKind, Near32),
81
    ENUM_ENTRY(PointerKind, Far32),
82
    ENUM_ENTRY(PointerKind, Near64),
83
};
84
85
static const EnumEntry<uint8_t> PtrModeNames[] = {
86
    ENUM_ENTRY(PointerMode, Pointer),
87
    ENUM_ENTRY(PointerMode, LValueReference),
88
    ENUM_ENTRY(PointerMode, PointerToDataMember),
89
    ENUM_ENTRY(PointerMode, PointerToMemberFunction),
90
    ENUM_ENTRY(PointerMode, RValueReference),
91
};
92
93
static const EnumEntry<uint16_t> PtrMemberRepNames[] = {
94
    ENUM_ENTRY(PointerToMemberRepresentation, Unknown),
95
    ENUM_ENTRY(PointerToMemberRepresentation, SingleInheritanceData),
96
    ENUM_ENTRY(PointerToMemberRepresentation, MultipleInheritanceData),
97
    ENUM_ENTRY(PointerToMemberRepresentation, VirtualInheritanceData),
98
    ENUM_ENTRY(PointerToMemberRepresentation, GeneralData),
99
    ENUM_ENTRY(PointerToMemberRepresentation, SingleInheritanceFunction),
100
    ENUM_ENTRY(PointerToMemberRepresentation, MultipleInheritanceFunction),
101
    ENUM_ENTRY(PointerToMemberRepresentation, VirtualInheritanceFunction),
102
    ENUM_ENTRY(PointerToMemberRepresentation, GeneralFunction),
103
};
104
105
static const EnumEntry<uint16_t> TypeModifierNames[] = {
106
    ENUM_ENTRY(ModifierOptions, Const), ENUM_ENTRY(ModifierOptions, Volatile),
107
    ENUM_ENTRY(ModifierOptions, Unaligned),
108
};
109
110
static const EnumEntry<uint8_t> CallingConventions[] = {
111
    ENUM_ENTRY(CallingConvention, NearC),
112
    ENUM_ENTRY(CallingConvention, FarC),
113
    ENUM_ENTRY(CallingConvention, NearPascal),
114
    ENUM_ENTRY(CallingConvention, FarPascal),
115
    ENUM_ENTRY(CallingConvention, NearFast),
116
    ENUM_ENTRY(CallingConvention, FarFast),
117
    ENUM_ENTRY(CallingConvention, NearStdCall),
118
    ENUM_ENTRY(CallingConvention, FarStdCall),
119
    ENUM_ENTRY(CallingConvention, NearSysCall),
120
    ENUM_ENTRY(CallingConvention, FarSysCall),
121
    ENUM_ENTRY(CallingConvention, ThisCall),
122
    ENUM_ENTRY(CallingConvention, MipsCall),
123
    ENUM_ENTRY(CallingConvention, Generic),
124
    ENUM_ENTRY(CallingConvention, AlphaCall),
125
    ENUM_ENTRY(CallingConvention, PpcCall),
126
    ENUM_ENTRY(CallingConvention, SHCall),
127
    ENUM_ENTRY(CallingConvention, ArmCall),
128
    ENUM_ENTRY(CallingConvention, AM33Call),
129
    ENUM_ENTRY(CallingConvention, TriCall),
130
    ENUM_ENTRY(CallingConvention, SH5Call),
131
    ENUM_ENTRY(CallingConvention, M32RCall),
132
    ENUM_ENTRY(CallingConvention, ClrCall),
133
    ENUM_ENTRY(CallingConvention, Inline),
134
    ENUM_ENTRY(CallingConvention, NearVector),
135
};
136
137
static const EnumEntry<uint8_t> FunctionOptionEnum[] = {
138
    ENUM_ENTRY(FunctionOptions, CxxReturnUdt),
139
    ENUM_ENTRY(FunctionOptions, Constructor),
140
    ENUM_ENTRY(FunctionOptions, ConstructorWithVirtualBases),
141
};
142
143
static const EnumEntry<uint16_t> LabelTypeEnum[] = {
144
    ENUM_ENTRY(LabelType, Near), ENUM_ENTRY(LabelType, Far),
145
};
146
147
#undef ENUM_ENTRY
148
149
25.2k
static StringRef getLeafTypeName(TypeLeafKind LT) {
150
25.2k
  switch (LT) {
151
25.2k
#define TYPE_RECORD(ename, value, name)                                        \
152
25.2k
  case ename:                                                                  \
153
25.2k
    return #name;
154
25.2k
#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
155
25.2k
  default:
156
0
    break;
157
0
  }
158
0
  return "UnknownLeaf";
159
0
}
160
161
10.5k
void TypeDumpVisitor::printTypeIndex(StringRef FieldName, TypeIndex TI) const {
162
10.5k
  codeview::printTypeIndex(*W, FieldName, TI, TpiTypes);
163
10.5k
}
164
165
3.07k
void TypeDumpVisitor::printItemIndex(StringRef FieldName, TypeIndex TI) const {
166
3.07k
  codeview::printTypeIndex(*W, FieldName, TI, getSourceTypes());
167
3.07k
}
168
169
0
Error TypeDumpVisitor::visitTypeBegin(CVType &Record) {
170
0
  return visitTypeBegin(Record, TypeIndex::fromArrayIndex(TpiTypes.size()));
171
0
}
172
173
6.37k
Error TypeDumpVisitor::visitTypeBegin(CVType &Record, TypeIndex Index) {
174
6.37k
  W->startLine() << getLeafTypeName(Record.kind());
175
6.37k
  W->getOStream() << " (" << HexNumber(Index.getIndex()) << ")";
176
6.37k
  W->getOStream() << " {\n";
177
6.37k
  W->indent();
178
6.37k
  W->printEnum("TypeLeafKind", unsigned(Record.kind()),
179
6.37k
               makeArrayRef(LeafTypeNames));
180
6.37k
  return Error::success();
181
6.37k
}
182
183
6.37k
Error TypeDumpVisitor::visitTypeEnd(CVType &Record) {
184
6.37k
  if (PrintRecordBytes)
185
25
    W->printBinaryBlock("LeafData", getBytesAsCharacters(Record.content()));
186
6.37k
187
6.37k
  W->unindent();
188
6.37k
  W->startLine() << "}\n";
189
6.37k
  return Error::success();
190
6.37k
}
191
192
18.8k
Error TypeDumpVisitor::visitMemberBegin(CVMemberRecord &Record) {
193
18.8k
  W->startLine() << getLeafTypeName(Record.Kind);
194
18.8k
  W->getOStream() << " {\n";
195
18.8k
  W->indent();
196
18.8k
  W->printEnum("TypeLeafKind", unsigned(Record.Kind),
197
18.8k
               makeArrayRef(LeafTypeNames));
198
18.8k
  return Error::success();
199
18.8k
}
200
201
18.8k
Error TypeDumpVisitor::visitMemberEnd(CVMemberRecord &Record) {
202
18.8k
  if (PrintRecordBytes)
203
0
    W->printBinaryBlock("LeafData", getBytesAsCharacters(Record.Data));
204
18.8k
205
18.8k
  W->unindent();
206
18.8k
  W->startLine() << "}\n";
207
18.8k
  return Error::success();
208
18.8k
}
209
210
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR,
211
601
                                        FieldListRecord &FieldList) {
212
601
  if (auto EC = codeview::visitMemberRecordStream(FieldList.Data, *this))
213
0
    return EC;
214
601
215
601
  return Error::success();
216
601
}
217
218
735
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, StringIdRecord &String) {
219
735
  printItemIndex("Id", String.getId());
220
735
  W->printString("StringData", String.getString());
221
735
  return Error::success();
222
735
}
223
224
473
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ArgListRecord &Args) {
225
473
  auto Indices = Args.getIndices();
226
473
  uint32_t Size = Indices.size();
227
473
  W->printNumber("NumArgs", Size);
228
473
  ListScope Arguments(*W, "Arguments");
229
973
  for (uint32_t I = 0; I < Size; 
++I500
) {
230
500
    printTypeIndex("ArgType", Indices[I]);
231
500
  }
232
473
  return Error::success();
233
473
}
234
235
21
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, StringListRecord &Strs) {
236
21
  auto Indices = Strs.getIndices();
237
21
  uint32_t Size = Indices.size();
238
21
  W->printNumber("NumStrings", Size);
239
21
  ListScope Arguments(*W, "Strings");
240
44
  for (uint32_t I = 0; I < Size; 
++I23
) {
241
23
    printItemIndex("String", Indices[I]);
242
23
  }
243
21
  return Error::success();
244
21
}
245
246
989
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ClassRecord &Class) {
247
989
  uint16_t Props = static_cast<uint16_t>(Class.getOptions());
248
989
  W->printNumber("MemberCount", Class.getMemberCount());
249
989
  W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
250
989
  printTypeIndex("FieldList", Class.getFieldList());
251
989
  printTypeIndex("DerivedFrom", Class.getDerivationList());
252
989
  printTypeIndex("VShape", Class.getVTableShape());
253
989
  W->printNumber("SizeOf", Class.getSize());
254
989
  W->printString("Name", Class.getName());
255
989
  if (Props & uint16_t(ClassOptions::HasUniqueName))
256
896
    W->printString("LinkageName", Class.getUniqueName());
257
989
  return Error::success();
258
989
}
259
260
67
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, UnionRecord &Union) {
261
67
  uint16_t Props = static_cast<uint16_t>(Union.getOptions());
262
67
  W->printNumber("MemberCount", Union.getMemberCount());
263
67
  W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
264
67
  printTypeIndex("FieldList", Union.getFieldList());
265
67
  W->printNumber("SizeOf", Union.getSize());
266
67
  W->printString("Name", Union.getName());
267
67
  if (Props & uint16_t(ClassOptions::HasUniqueName))
268
62
    W->printString("LinkageName", Union.getUniqueName());
269
67
  return Error::success();
270
67
}
271
272
87
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, EnumRecord &Enum) {
273
87
  uint16_t Props = static_cast<uint16_t>(Enum.getOptions());
274
87
  W->printNumber("NumEnumerators", Enum.getMemberCount());
275
87
  W->printFlags("Properties", uint16_t(Enum.getOptions()),
276
87
                makeArrayRef(ClassOptionNames));
277
87
  printTypeIndex("UnderlyingType", Enum.getUnderlyingType());
278
87
  printTypeIndex("FieldListType", Enum.getFieldList());
279
87
  W->printString("Name", Enum.getName());
280
87
  if (Props & uint16_t(ClassOptions::HasUniqueName))
281
84
    W->printString("LinkageName", Enum.getUniqueName());
282
87
  return Error::success();
283
87
}
284
285
59
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ArrayRecord &AT) {
286
59
  printTypeIndex("ElementType", AT.getElementType());
287
59
  printTypeIndex("IndexType", AT.getIndexType());
288
59
  W->printNumber("SizeOf", AT.getSize());
289
59
  W->printString("Name", AT.getName());
290
59
  return Error::success();
291
59
}
292
293
7
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, VFTableRecord &VFT) {
294
7
  printTypeIndex("CompleteClass", VFT.getCompleteClass());
295
7
  printTypeIndex("OverriddenVFTable", VFT.getOverriddenVTable());
296
7
  W->printHex("VFPtrOffset", VFT.getVFPtrOffset());
297
7
  W->printString("VFTableName", VFT.getName());
298
7
  for (auto N : VFT.getMethodNames())
299
12
    W->printString("MethodName", N);
300
7
  return Error::success();
301
7
}
302
303
115
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, MemberFuncIdRecord &Id) {
304
115
  printTypeIndex("ClassType", Id.getClassType());
305
115
  printTypeIndex("FunctionType", Id.getFunctionType());
306
115
  W->printString("Name", Id.getName());
307
115
  return Error::success();
308
115
}
309
310
350
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ProcedureRecord &Proc) {
311
350
  printTypeIndex("ReturnType", Proc.getReturnType());
312
350
  W->printEnum("CallingConvention", uint8_t(Proc.getCallConv()),
313
350
               makeArrayRef(CallingConventions));
314
350
  W->printFlags("FunctionOptions", uint8_t(Proc.getOptions()),
315
350
                makeArrayRef(FunctionOptionEnum));
316
350
  W->printNumber("NumParameters", Proc.getParameterCount());
317
350
  printTypeIndex("ArgListType", Proc.getArgumentList());
318
350
  return Error::success();
319
350
}
320
321
545
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, MemberFunctionRecord &MF) {
322
545
  printTypeIndex("ReturnType", MF.getReturnType());
323
545
  printTypeIndex("ClassType", MF.getClassType());
324
545
  printTypeIndex("ThisType", MF.getThisType());
325
545
  W->printEnum("CallingConvention", uint8_t(MF.getCallConv()),
326
545
               makeArrayRef(CallingConventions));
327
545
  W->printFlags("FunctionOptions", uint8_t(MF.getOptions()),
328
545
                makeArrayRef(FunctionOptionEnum));
329
545
  W->printNumber("NumParameters", MF.getParameterCount());
330
545
  printTypeIndex("ArgListType", MF.getArgumentList());
331
545
  W->printNumber("ThisAdjustment", MF.getThisPointerAdjustment());
332
545
  return Error::success();
333
545
}
334
335
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR,
336
97
                                        MethodOverloadListRecord &MethodList) {
337
232
  for (auto &M : MethodList.getMethods()) {
338
232
    ListScope S(*W, "Method");
339
232
    printMemberAttributes(M.getAccess(), M.getMethodKind(), M.getOptions());
340
232
    printTypeIndex("Type", M.getType());
341
232
    if (M.isIntroducingVirtual())
342
0
      W->printHex("VFTableOffset", M.getVFTableOffset());
343
232
  }
344
97
  return Error::success();
345
97
}
346
347
446
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, FuncIdRecord &Func) {
348
446
  printItemIndex("ParentScope", Func.getParentScope());
349
446
  printTypeIndex("FunctionType", Func.getFunctionType());
350
446
  W->printString("Name", Func.getName());
351
446
  return Error::success();
352
446
}
353
354
0
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, TypeServer2Record &TS) {
355
0
  W->printString("Guid", formatv("{0}", TS.getGuid()).str());
356
0
  W->printNumber("Age", TS.getAge());
357
0
  W->printString("Name", TS.getName());
358
0
  return Error::success();
359
0
}
360
361
768
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, PointerRecord &Ptr) {
362
768
  printTypeIndex("PointeeType", Ptr.getReferentType());
363
768
  W->printEnum("PtrType", unsigned(Ptr.getPointerKind()),
364
768
               makeArrayRef(PtrKindNames));
365
768
  W->printEnum("PtrMode", unsigned(Ptr.getMode()), makeArrayRef(PtrModeNames));
366
768
367
768
  W->printNumber("IsFlat", Ptr.isFlat());
368
768
  W->printNumber("IsConst", Ptr.isConst());
369
768
  W->printNumber("IsVolatile", Ptr.isVolatile());
370
768
  W->printNumber("IsUnaligned", Ptr.isUnaligned());
371
768
  W->printNumber("IsRestrict", Ptr.isRestrict());
372
768
  W->printNumber("IsThisPtr&", Ptr.isLValueReferenceThisPtr());
373
768
  W->printNumber("IsThisPtr&&", Ptr.isRValueReferenceThisPtr());
374
768
  W->printNumber("SizeOf", Ptr.getSize());
375
768
376
768
  if (Ptr.isPointerToMember()) {
377
46
    const MemberPointerInfo &MI = Ptr.getMemberInfo();
378
46
379
46
    printTypeIndex("ClassType", MI.getContainingType());
380
46
    W->printEnum("Representation", uint16_t(MI.getRepresentation()),
381
46
                 makeArrayRef(PtrMemberRepNames));
382
46
  }
383
768
384
768
  return Error::success();
385
768
}
386
387
108
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ModifierRecord &Mod) {
388
108
  uint16_t Mods = static_cast<uint16_t>(Mod.getModifiers());
389
108
  printTypeIndex("ModifiedType", Mod.getModifiedType());
390
108
  W->printFlags("Modifiers", Mods, makeArrayRef(TypeModifierNames));
391
108
392
108
  return Error::success();
393
108
}
394
395
7
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, BitFieldRecord &BitField) {
396
7
  printTypeIndex("Type", BitField.getType());
397
7
  W->printNumber("BitSize", BitField.getBitSize());
398
7
  W->printNumber("BitOffset", BitField.getBitOffset());
399
7
  return Error::success();
400
7
}
401
402
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR,
403
33
                                        VFTableShapeRecord &Shape) {
404
33
  W->printNumber("VFEntryCount", Shape.getEntryCount());
405
33
  return Error::success();
406
33
}
407
408
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR,
409
605
                                        UdtSourceLineRecord &Line) {
410
605
  printTypeIndex("UDT", Line.getUDT());
411
605
  printItemIndex("SourceFile", Line.getSourceFile());
412
605
  W->printNumber("LineNumber", Line.getLineNumber());
413
605
  return Error::success();
414
605
}
415
416
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR,
417
0
                                        UdtModSourceLineRecord &Line) {
418
0
  printTypeIndex("UDT", Line.getUDT());
419
0
  printItemIndex("SourceFile", Line.getSourceFile());
420
0
  W->printNumber("LineNumber", Line.getLineNumber());
421
0
  W->printNumber("Module", Line.getModule());
422
0
  return Error::success();
423
0
}
424
425
254
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, BuildInfoRecord &Args) {
426
254
  W->printNumber("NumArgs", static_cast<uint32_t>(Args.getArgs().size()));
427
254
428
254
  ListScope Arguments(*W, "Arguments");
429
1.27k
  for (auto Arg : Args.getArgs()) {
430
1.27k
    printItemIndex("ArgType", Arg);
431
1.27k
  }
432
254
  return Error::success();
433
254
}
434
435
0
void TypeDumpVisitor::printMemberAttributes(MemberAttributes Attrs) {
436
0
  return printMemberAttributes(Attrs.getAccess(), Attrs.getMethodKind(),
437
0
                               Attrs.getFlags());
438
0
}
439
440
void TypeDumpVisitor::printMemberAttributes(MemberAccess Access,
441
                                            MethodKind Kind,
442
18.8k
                                            MethodOptions Options) {
443
18.8k
  W->printEnum("AccessSpecifier", uint8_t(Access),
444
18.8k
               makeArrayRef(MemberAccessNames));
445
18.8k
  // Data members will be vanilla. Don't try to print a method kind for them.
446
18.8k
  if (Kind != MethodKind::Vanilla)
447
86
    W->printEnum("MethodKind", unsigned(Kind), makeArrayRef(MemberKindNames));
448
18.8k
  if (Options != MethodOptions::None) {
449
45
    W->printFlags("MethodOptions", unsigned(Options),
450
45
                  makeArrayRef(MethodOptionNames));
451
45
  }
452
18.8k
}
453
454
0
Error TypeDumpVisitor::visitUnknownMember(CVMemberRecord &Record) {
455
0
  W->printHex("UnknownMember", unsigned(Record.Kind));
456
0
  return Error::success();
457
0
}
458
459
0
Error TypeDumpVisitor::visitUnknownType(CVType &Record) {
460
0
  W->printEnum("Kind", uint16_t(Record.kind()), makeArrayRef(LeafTypeNames));
461
0
  W->printNumber("Length", uint32_t(Record.content().size()));
462
0
  return Error::success();
463
0
}
464
465
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
466
95
                                        NestedTypeRecord &Nested) {
467
95
  printTypeIndex("Type", Nested.getNestedType());
468
95
  W->printString("Name", Nested.getName());
469
95
  return Error::success();
470
95
}
471
472
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
473
304
                                        OneMethodRecord &Method) {
474
304
  MethodKind K = Method.getMethodKind();
475
304
  printMemberAttributes(Method.getAccess(), K, Method.getOptions());
476
304
  printTypeIndex("Type", Method.getType());
477
304
  // If virtual, then read the vftable offset.
478
304
  if (Method.isIntroducingVirtual())
479
41
    W->printHex("VFTableOffset", Method.getVFTableOffset());
480
304
  W->printString("Name", Method.getName());
481
304
  return Error::success();
482
304
}
483
484
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
485
97
                                        OverloadedMethodRecord &Method) {
486
97
  W->printHex("MethodCount", Method.getNumOverloads());
487
97
  printTypeIndex("MethodListIndex", Method.getMethodList());
488
97
  W->printString("Name", Method.getName());
489
97
  return Error::success();
490
97
}
491
492
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
493
634
                                        DataMemberRecord &Field) {
494
634
  printMemberAttributes(Field.getAccess(), MethodKind::Vanilla,
495
634
                        MethodOptions::None);
496
634
  printTypeIndex("Type", Field.getType());
497
634
  W->printHex("FieldOffset", Field.getFieldOffset());
498
634
  W->printString("Name", Field.getName());
499
634
  return Error::success();
500
634
}
501
502
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
503
59
                                        StaticDataMemberRecord &Field) {
504
59
  printMemberAttributes(Field.getAccess(), MethodKind::Vanilla,
505
59
                        MethodOptions::None);
506
59
  printTypeIndex("Type", Field.getType());
507
59
  W->printString("Name", Field.getName());
508
59
  return Error::success();
509
59
}
510
511
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
512
35
                                        VFPtrRecord &VFTable) {
513
35
  printTypeIndex("Type", VFTable.getType());
514
35
  return Error::success();
515
35
}
516
517
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
518
17.5k
                                        EnumeratorRecord &Enum) {
519
17.5k
  printMemberAttributes(Enum.getAccess(), MethodKind::Vanilla,
520
17.5k
                        MethodOptions::None);
521
17.5k
  W->printNumber("EnumValue", Enum.getValue());
522
17.5k
  W->printString("Name", Enum.getName());
523
17.5k
  return Error::success();
524
17.5k
}
525
526
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
527
51
                                        BaseClassRecord &Base) {
528
51
  printMemberAttributes(Base.getAccess(), MethodKind::Vanilla,
529
51
                        MethodOptions::None);
530
51
  printTypeIndex("BaseType", Base.getBaseType());
531
51
  W->printHex("BaseOffset", Base.getBaseOffset());
532
51
  return Error::success();
533
51
}
534
535
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
536
26
                                        VirtualBaseClassRecord &Base) {
537
26
  printMemberAttributes(Base.getAccess(), MethodKind::Vanilla,
538
26
                        MethodOptions::None);
539
26
  printTypeIndex("BaseType", Base.getBaseType());
540
26
  printTypeIndex("VBPtrType", Base.getVBPtrType());
541
26
  W->printHex("VBPtrOffset", Base.getVBPtrOffset());
542
26
  W->printHex("VBTableIndex", Base.getVTableIndex());
543
26
  return Error::success();
544
26
}
545
546
Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
547
12
                                        ListContinuationRecord &Cont) {
548
12
  printTypeIndex("ContinuationIndex", Cont.getContinuationIndex());
549
12
  return Error::success();
550
12
}
551
552
1
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, LabelRecord &LR) {
553
1
  W->printEnum("Mode", uint16_t(LR.Mode), makeArrayRef(LabelTypeEnum));
554
1
  return Error::success();
555
1
}
556
557
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR,
558
1
                                        PrecompRecord &Precomp) {
559
1
  W->printHex("StartIndex", Precomp.getStartTypeIndex());
560
1
  W->printHex("Count", Precomp.getTypesCount());
561
1
  W->printHex("Signature", Precomp.getSignature());
562
1
  W->printString("PrecompFile", Precomp.getPrecompFilePath());
563
1
  return Error::success();
564
1
}
565
566
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR,
567
1
                                        EndPrecompRecord &EndPrecomp) {
568
1
  W->printHex("Signature", EndPrecomp.getSignature());
569
1
  return Error::success();
570
1
}