Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- TypeRecordMapping.cpp ------------------------------------*- 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/TypeRecordMapping.h"
10
11
using namespace llvm;
12
using namespace llvm::codeview;
13
14
#define error(X)                                                               \
15
511k
  
if (auto 10.2k
EC =
X7.39k
) \
TypeRecordMapping.cpp:llvm::codeview::TypeRecordMapping::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArgListRecord&)::$_0::operator()(llvm::codeview::CodeViewRecordIO&, llvm::codeview::TypeIndex&) const
Line
Count
Source
15
2.70k
  if (auto EC = X)                                                             \
TypeRecordMapping.cpp:llvm::codeview::TypeRecordMapping::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringListRecord&)::$_1::operator()(llvm::codeview::CodeViewRecordIO&, llvm::codeview::TypeIndex&) const
Line
Count
Source
15
110
  if (auto EC = X)                                                             \
TypeRecordMapping.cpp:llvm::codeview::TypeRecordMapping::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableRecord&)::$_2::operator()(llvm::codeview::CodeViewRecordIO&, llvm::StringRef&) const
Line
Count
Source
15
38
  if (auto EC = X)                                                             \
TypeRecordMapping.cpp:llvm::codeview::TypeRecordMapping::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BuildInfoRecord&)::$_3::operator()(llvm::codeview::CodeViewRecordIO&, llvm::codeview::TypeIndex&) const
Line
Count
Source
15
4.53k
  if (auto EC = X)                                                             \
16
10.2k
    
return EC0
;
17
18
namespace {
19
struct MapOneMethodRecord {
20
  explicit MapOneMethodRecord(bool IsFromOverloadList)
21
1.64k
      : IsFromOverloadList(IsFromOverloadList) {}
22
23
2.36k
  Error operator()(CodeViewRecordIO &IO, OneMethodRecord &Method) const {
24
2.36k
    error(IO.mapInteger(Method.Attrs.Attrs, "AccessSpecifier"));
25
2.36k
    if (IsFromOverloadList) {
26
1.21k
      uint16_t Padding = 0;
27
1.21k
      error(IO.mapInteger(Padding, "Padding"));
28
1.21k
    }
29
2.36k
    error(IO.mapInteger(Method.Type, "Type"));
30
2.36k
    if (Method.isIntroducingVirtual()) {
31
131
      error(IO.mapInteger(Method.VFTableOffset, "VFTableOffset"));
32
2.23k
    } else if (IO.isReading())
33
1.85k
      Method.VFTableOffset = -1;
34
2.36k
35
2.36k
    if (!IsFromOverloadList)
36
2.36k
      
error1.14k
(IO.mapStringZ(Method.Name, "Name"));
37
2.36k
38
2.36k
    return Error::success();
39
2.36k
  }
40
41
private:
42
  bool IsFromOverloadList;
43
};
44
}
45
46
static Error mapNameAndUniqueName(CodeViewRecordIO &IO, StringRef &Name,
47
8.21k
                                  StringRef &UniqueName, bool HasUniqueName) {
48
8.21k
  if (IO.isWriting()) {
49
668
    // Try to be smart about what we write here.  We can't write anything too
50
668
    // large, so if we're going to go over the limit, truncate both the name
51
668
    // and unique name by the same amount.
52
668
    size_t BytesLeft = IO.maxFieldLength();
53
668
    if (HasUniqueName) {
54
583
      size_t BytesNeeded = Name.size() + UniqueName.size() + 2;
55
583
      StringRef N = Name;
56
583
      StringRef U = UniqueName;
57
583
      if (BytesNeeded > BytesLeft) {
58
5
        size_t BytesToDrop = (BytesNeeded - BytesLeft);
59
5
        size_t DropN = std::min(N.size(), BytesToDrop / 2);
60
5
        size_t DropU = std::min(U.size(), BytesToDrop - DropN);
61
5
62
5
        N = N.drop_back(DropN);
63
5
        U = U.drop_back(DropU);
64
5
      }
65
583
66
583
      error(IO.mapStringZ(N));
67
583
      error(IO.mapStringZ(U));
68
583
    } else {
69
85
      // Cap the length of the string at however many bytes we have available,
70
85
      // plus one for the required null terminator.
71
85
      auto N = StringRef(Name).take_front(BytesLeft - 1);
72
85
      error(IO.mapStringZ(N));
73
85
    }
74
7.54k
  } else {
75
7.54k
    // Reading & Streaming mode come after writing mode is executed for each
76
7.54k
    // record. Truncating large names are done during writing, so its not
77
7.54k
    // necessary to do it while reading or streaming.
78
7.54k
    error(IO.mapStringZ(Name, "Name"));
79
7.54k
    if (HasUniqueName)
80
7.54k
      
error7.24k
(IO.mapStringZ(UniqueName, "LinkageName"));
81
7.54k
  }
82
8.21k
83
8.21k
  return Error::success();
84
8.21k
}
85
86
11.8k
static StringRef getLeafTypeName(TypeLeafKind LT) {
87
11.8k
  switch (LT) {
88
11.8k
#define TYPE_RECORD(ename, value, name)                                        \
89
11.8k
  case ename:                                                                  \
90
11.8k
    return #ename;
91
11.8k
#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
92
11.8k
  default:
93
0
    break;
94
0
  }
95
0
  return "UnknownLeaf";
96
0
}
97
98
32.5k
Error TypeRecordMapping::visitTypeBegin(CVType &CVR) {
99
32.5k
  assert(!TypeKind.hasValue() && "Already in a type mapping!");
100
32.5k
  assert(!MemberKind.hasValue() && "Already in a member mapping!");
101
32.5k
102
32.5k
  // FieldList and MethodList records can be any length because they can be
103
32.5k
  // split with continuation records.  All other record types cannot be
104
32.5k
  // longer than the maximum record length.
105
32.5k
  Optional<uint32_t> MaxLen;
106
32.5k
  if (CVR.kind() != TypeLeafKind::LF_FIELDLIST &&
107
32.5k
      
CVR.kind() != TypeLeafKind::LF_METHODLIST28.3k
)
108
27.8k
    MaxLen = MaxRecordLength - sizeof(RecordPrefix);
109
32.5k
  error(IO.beginRecord(MaxLen));
110
32.5k
  TypeKind = CVR.kind();
111
32.5k
  return Error::success();
112
32.5k
}
113
114
3.11k
Error TypeRecordMapping::visitTypeBegin(CVType &CVR, TypeIndex Index) {
115
3.11k
  return visitTypeBegin(CVR);
116
3.11k
}
117
118
32.5k
Error TypeRecordMapping::visitTypeEnd(CVType &Record) {
119
32.5k
  assert(TypeKind.hasValue() && "Not in a type mapping!");
120
32.5k
  assert(!MemberKind.hasValue() && "Still in a member mapping!");
121
32.5k
122
32.5k
  error(IO.endRecord());
123
32.5k
124
32.5k
  TypeKind.reset();
125
32.5k
  return Error::success();
126
32.5k
}
127
128
58.4k
Error TypeRecordMapping::visitMemberBegin(CVMemberRecord &Record) {
129
58.4k
  assert(TypeKind.hasValue() && "Not in a type mapping!");
130
58.4k
  assert(!MemberKind.hasValue() && "Already in a member mapping!");
131
58.4k
132
58.4k
  // The largest possible subrecord is one in which there is a record prefix,
133
58.4k
  // followed by the subrecord, followed by a continuation, and that entire
134
58.4k
  // sequence spaws `MaxRecordLength` bytes.  So the record's length is
135
58.4k
  // calculated as follows.
136
58.4k
137
58.4k
  constexpr uint32_t ContinuationLength = 8;
138
58.4k
  error(IO.beginRecord(MaxRecordLength - sizeof(RecordPrefix) -
139
58.4k
                       ContinuationLength));
140
58.4k
141
58.4k
  MemberKind = Record.Kind;
142
58.4k
  if (IO.isStreaming()) {
143
11.8k
    error(IO.mapEnum(Record.Kind,
144
11.8k
                     "Member kind: " + getLeafTypeName(Record.Kind)));
145
11.8k
  }
146
58.4k
  return Error::success();
147
58.4k
}
148
149
58.4k
Error TypeRecordMapping::visitMemberEnd(CVMemberRecord &Record) {
150
58.4k
  assert(TypeKind.hasValue() && "Not in a type mapping!");
151
58.4k
  assert(MemberKind.hasValue() && "Not in a member mapping!");
152
58.4k
153
58.4k
  if (IO.isReading()) {
154
34.0k
    if (auto EC = IO.skipPadding())
155
0
      return EC;
156
58.4k
  }
157
58.4k
158
58.4k
  MemberKind.reset();
159
58.4k
  error(IO.endRecord());
160
58.4k
  return Error::success();
161
58.4k
}
162
163
520
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ModifierRecord &Record) {
164
520
  error(IO.mapInteger(Record.ModifiedType, "ModifiedType"));
165
520
  error(IO.mapEnum(Record.Modifiers, "Modifiers"));
166
520
  return Error::success();
167
520
}
168
169
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
170
1.55k
                                          ProcedureRecord &Record) {
171
1.55k
  error(IO.mapInteger(Record.ReturnType, "ReturnType"));
172
1.55k
  error(IO.mapEnum(Record.CallConv, "CallingConvention"));
173
1.55k
  error(IO.mapEnum(Record.Options, "FunctionOptions"));
174
1.55k
  error(IO.mapInteger(Record.ParameterCount, "NumParameters"));
175
1.55k
  error(IO.mapInteger(Record.ArgumentList, "ArgListType"));
176
1.55k
177
1.55k
  return Error::success();
178
1.55k
}
179
180
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
181
2.75k
                                          MemberFunctionRecord &Record) {
182
2.75k
  error(IO.mapInteger(Record.ReturnType, "ReturnType"));
183
2.75k
  error(IO.mapInteger(Record.ClassType, "ClassType"));
184
2.75k
  error(IO.mapInteger(Record.ThisType, "ThisType"));
185
2.75k
  error(IO.mapEnum(Record.CallConv, "CallingConvention"));
186
2.75k
  error(IO.mapEnum(Record.Options, "FunctionOptions"));
187
2.75k
  error(IO.mapInteger(Record.ParameterCount, "NumParameters"));
188
2.75k
  error(IO.mapInteger(Record.ArgumentList, "ArgListType"));
189
2.75k
  error(IO.mapInteger(Record.ThisPointerAdjustment, "ThisAdjustment"));
190
2.75k
191
2.75k
  return Error::success();
192
2.75k
}
193
194
2.46k
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ArgListRecord &Record) {
195
2.46k
  error(IO.mapVectorN<uint32_t>(
196
2.46k
      Record.ArgIndices,
197
2.46k
      [](CodeViewRecordIO &IO, TypeIndex &N) {
198
2.46k
        return IO.mapInteger(N, "Argument");
199
2.46k
      },
200
2.46k
      "NumArgs"));
201
2.46k
  return Error::success();
202
2.46k
}
203
204
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
205
90
                                          StringListRecord &Record) {
206
90
  error(IO.mapVectorN<uint32_t>(
207
90
      Record.StringIndices,
208
90
      [](CodeViewRecordIO &IO, TypeIndex &N) {
209
90
        return IO.mapInteger(N, "Strings");
210
90
      },
211
90
      "NumStrings"));
212
90
213
90
  return Error::success();
214
90
}
215
216
3.36k
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, PointerRecord &Record) {
217
3.36k
  error(IO.mapInteger(Record.ReferentType, "PointeeType"));
218
3.36k
  error(IO.mapInteger(Record.Attrs, "Attributes"));
219
3.36k
220
3.36k
  if (Record.isPointerToMember()) {
221
164
    if (IO.isReading())
222
98
      Record.MemberInfo.emplace();
223
164
224
164
    MemberPointerInfo &M = *Record.MemberInfo;
225
164
    error(IO.mapInteger(M.ContainingType, "ClassType"));
226
164
    error(IO.mapEnum(M.Representation, "Representation"));
227
164
  }
228
3.36k
229
3.36k
  return Error::success();
230
3.36k
}
231
232
286
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ArrayRecord &Record) {
233
286
  error(IO.mapInteger(Record.ElementType, "ElementType"));
234
286
  error(IO.mapInteger(Record.IndexType, "IndexType"));
235
286
  error(IO.mapEncodedInteger(Record.Size, "SizeOf"));
236
286
  error(IO.mapStringZ(Record.Name, "Name"));
237
286
238
286
  return Error::success();
239
286
}
240
241
7.22k
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ClassRecord &Record) {
242
7.22k
  assert((CVR.kind() == TypeLeafKind::LF_STRUCTURE) ||
243
7.22k
         (CVR.kind() == TypeLeafKind::LF_CLASS) ||
244
7.22k
         (CVR.kind() == TypeLeafKind::LF_INTERFACE));
245
7.22k
246
7.22k
  error(IO.mapInteger(Record.MemberCount, "MemberCount"));
247
7.22k
  error(IO.mapEnum(Record.Options, "Properties"));
248
7.22k
  error(IO.mapInteger(Record.FieldList, "FieldList"));
249
7.22k
  error(IO.mapInteger(Record.DerivationList, "DerivedFrom"));
250
7.22k
  error(IO.mapInteger(Record.VTableShape, "VShape"));
251
7.22k
  error(IO.mapEncodedInteger(Record.Size, "SizeOf"));
252
7.22k
  error(mapNameAndUniqueName(IO, Record.Name, Record.UniqueName,
253
7.22k
                             Record.hasUniqueName()));
254
7.22k
255
7.22k
  return Error::success();
256
7.22k
}
257
258
263
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, UnionRecord &Record) {
259
263
  error(IO.mapInteger(Record.MemberCount, "MemberCount"));
260
263
  error(IO.mapEnum(Record.Options, "Properties"));
261
263
  error(IO.mapInteger(Record.FieldList, "FieldList"));
262
263
  error(IO.mapEncodedInteger(Record.Size, "SizeOf"));
263
263
  error(mapNameAndUniqueName(IO, Record.Name, Record.UniqueName,
264
263
                             Record.hasUniqueName()));
265
263
266
263
  return Error::success();
267
263
}
268
269
732
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, EnumRecord &Record) {
270
732
  error(IO.mapInteger(Record.MemberCount, "NumEnumerators"));
271
732
  error(IO.mapEnum(Record.Options, "Properties"));
272
732
  error(IO.mapInteger(Record.UnderlyingType, "UnderlyingType"));
273
732
  error(IO.mapInteger(Record.FieldList, "FieldListType"));
274
732
  error(mapNameAndUniqueName(IO, Record.Name, Record.UniqueName,
275
732
                             Record.hasUniqueName()));
276
732
277
732
  return Error::success();
278
732
}
279
280
44
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, BitFieldRecord &Record) {
281
44
  error(IO.mapInteger(Record.Type, "Type"));
282
44
  error(IO.mapInteger(Record.BitSize, "BitSize"));
283
44
  error(IO.mapInteger(Record.BitOffset, "BitOffset"));
284
44
285
44
  return Error::success();
286
44
}
287
288
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
289
119
                                          VFTableShapeRecord &Record) {
290
119
  uint16_t Size;
291
119
  if (!IO.isReading()) {
292
42
    ArrayRef<VFTableSlotKind> Slots = Record.getSlots();
293
42
    Size = Slots.size();
294
42
    error(IO.mapInteger(Size, "VFEntryCount"));
295
42
296
82
    for (size_t SlotIndex = 0; SlotIndex < Slots.size(); 
SlotIndex += 240
) {
297
40
      uint8_t Byte = static_cast<uint8_t>(Slots[SlotIndex]) << 4;
298
40
      if ((SlotIndex + 1) < Slots.size()) {
299
8
        Byte |= static_cast<uint8_t>(Slots[SlotIndex + 1]);
300
8
      }
301
40
      error(IO.mapInteger(Byte));
302
40
    }
303
77
  } else {
304
77
    error(IO.mapInteger(Size));
305
156
    for (uint16_t I = 0; I < Size; 
I += 279
) {
306
79
      uint8_t Byte;
307
79
      error(IO.mapInteger(Byte));
308
79
      Record.Slots.push_back(static_cast<VFTableSlotKind>(Byte & 0xF));
309
79
      if ((I + 1) < Size)
310
22
        Record.Slots.push_back(static_cast<VFTableSlotKind>(Byte >> 4));
311
79
    }
312
77
  }
313
119
314
119
  return Error::success();
315
119
}
316
317
17
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, VFTableRecord &Record) {
318
17
  error(IO.mapInteger(Record.CompleteClass, "CompleteClass"));
319
17
  error(IO.mapInteger(Record.OverriddenVFTable, "OverriddenVFTable"));
320
17
  error(IO.mapInteger(Record.VFPtrOffset, "VFPtrOffset"));
321
17
  uint32_t NamesLen = 0;
322
17
  if (!IO.isReading()) {
323
6
    for (auto Name : Record.MethodNames)
324
10
      NamesLen += Name.size() + 1;
325
6
  }
326
17
  error(IO.mapInteger(NamesLen));
327
17
  error(IO.mapVectorTail(
328
17
      Record.MethodNames,
329
17
      [](CodeViewRecordIO &IO, StringRef &S) {
330
17
        return IO.mapStringZ(S, "MethodName");
331
17
      },
332
17
      "VFTableName"));
333
17
334
17
  return Error::success();
335
17
}
336
337
3.14k
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, StringIdRecord &Record) {
338
3.14k
  error(IO.mapInteger(Record.Id, "Id"));
339
3.14k
  error(IO.mapStringZ(Record.String, "StringData"));
340
3.14k
341
3.14k
  return Error::success();
342
3.14k
}
343
344
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
345
2.30k
                                          UdtSourceLineRecord &Record) {
346
2.30k
  error(IO.mapInteger(Record.UDT, "UDT"));
347
2.30k
  error(IO.mapInteger(Record.SourceFile, "SourceFile"));
348
2.30k
  error(IO.mapInteger(Record.LineNumber, "LineNumber"));
349
2.30k
350
2.30k
  return Error::success();
351
2.30k
}
352
353
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
354
59
                                          UdtModSourceLineRecord &Record) {
355
59
  error(IO.mapInteger(Record.UDT, "UDT"));
356
59
  error(IO.mapInteger(Record.SourceFile, "SourceFile"));
357
59
  error(IO.mapInteger(Record.LineNumber, "LineNumber"));
358
59
  error(IO.mapInteger(Record.Module, "Module"));
359
59
360
59
  return Error::success();
361
59
}
362
363
1.60k
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, FuncIdRecord &Record) {
364
1.60k
  error(IO.mapInteger(Record.ParentScope, "ParentScope"));
365
1.60k
  error(IO.mapInteger(Record.FunctionType, "FunctionType"));
366
1.60k
  error(IO.mapStringZ(Record.Name, "Name"));
367
1.60k
368
1.60k
  return Error::success();
369
1.60k
}
370
371
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
372
377
                                          MemberFuncIdRecord &Record) {
373
377
  error(IO.mapInteger(Record.ClassType, "ClassType"));
374
377
  error(IO.mapInteger(Record.FunctionType, "FunctionType"));
375
377
  error(IO.mapStringZ(Record.Name, "Name"));
376
377
377
377
  return Error::success();
378
377
}
379
380
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
381
908
                                          BuildInfoRecord &Record) {
382
908
  error(IO.mapVectorN<uint16_t>(
383
908
      Record.ArgIndices,
384
908
      [](CodeViewRecordIO &IO, TypeIndex &N) {
385
908
        return IO.mapInteger(N, "Argument");
386
908
      },
387
908
      "NumArgs"));
388
908
389
908
  return Error::success();
390
908
}
391
392
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
393
498
                                          MethodOverloadListRecord &Record) {
394
498
  // TODO: Split the list into multiple records if it's longer than 64KB, using
395
498
  // a subrecord of TypeRecordKind::Index to chain the records together.
396
498
  error(IO.mapVectorTail(Record.Methods, MapOneMethodRecord(true), "Method"));
397
498
398
498
  return Error::success();
399
498
}
400
401
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
402
2.12k
                                          FieldListRecord &Record) {
403
2.12k
  if (IO.isStreaming()) {
404
237
    if (auto EC = codeview::visitMemberRecordStream(Record.Data, *this))
405
0
      return EC;
406
2.12k
  } else
407
2.12k
    error(IO.mapByteVectorTail(Record.Data));
408
2.12k
409
2.12k
  return Error::success();
410
2.12k
}
411
412
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
413
29
                                          TypeServer2Record &Record) {
414
29
  error(IO.mapGuid(Record.Guid, "Guid"));
415
29
  error(IO.mapInteger(Record.Age, "Age"));
416
29
  error(IO.mapStringZ(Record.Name, "Name"));
417
29
  return Error::success();
418
29
}
419
420
1
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, LabelRecord &Record) {
421
1
  error(IO.mapEnum(Record.Mode, "Mode"));
422
1
  return Error::success();
423
1
}
424
425
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
426
152
                                          BaseClassRecord &Record) {
427
152
  error(IO.mapInteger(Record.Attrs.Attrs, "AccessSpecifier"));
428
152
  error(IO.mapInteger(Record.Type, "BaseType"));
429
152
  error(IO.mapEncodedInteger(Record.Offset, "BaseOffset"));
430
152
431
152
  return Error::success();
432
152
}
433
434
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
435
53.2k
                                          EnumeratorRecord &Record) {
436
53.2k
  error(IO.mapInteger(Record.Attrs.Attrs));
437
53.2k
438
53.2k
  // FIXME: Handle full APInt such as __int128.
439
53.2k
  error(IO.mapEncodedInteger(Record.Value, "EnumValue"));
440
53.2k
  error(IO.mapStringZ(Record.Name, "Name"));
441
53.2k
442
53.2k
  return Error::success();
443
53.2k
}
444
445
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
446
2.51k
                                          DataMemberRecord &Record) {
447
2.51k
  error(IO.mapInteger(Record.Attrs.Attrs, "AccessSpecifier"));
448
2.51k
  error(IO.mapInteger(Record.Type, "Type"));
449
2.51k
  error(IO.mapEncodedInteger(Record.FieldOffset, "FieldOffset"));
450
2.51k
  error(IO.mapStringZ(Record.Name, "Name"));
451
2.51k
452
2.51k
  return Error::success();
453
2.51k
}
454
455
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
456
405
                                          OverloadedMethodRecord &Record) {
457
405
  error(IO.mapInteger(Record.NumOverloads, "MethodCount"));
458
405
  error(IO.mapInteger(Record.MethodList, "MethodListIndex"));
459
405
  error(IO.mapStringZ(Record.Name, "Name"));
460
405
461
405
  return Error::success();
462
405
}
463
464
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
465
1.14k
                                          OneMethodRecord &Record) {
466
1.14k
  const bool IsFromOverloadList = (TypeKind == LF_METHODLIST);
467
1.14k
  MapOneMethodRecord Mapper(IsFromOverloadList);
468
1.14k
  return Mapper(IO, Record);
469
1.14k
}
470
471
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
472
377
                                          NestedTypeRecord &Record) {
473
377
  uint16_t Padding = 0;
474
377
  error(IO.mapInteger(Padding, "Padding"));
475
377
  error(IO.mapInteger(Record.Type, "Type"));
476
377
  error(IO.mapStringZ(Record.Name, "Name"));
477
377
478
377
  return Error::success();
479
377
}
480
481
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
482
258
                                          StaticDataMemberRecord &Record) {
483
258
484
258
  error(IO.mapInteger(Record.Attrs.Attrs, "AccessSpecifier"));
485
258
  error(IO.mapInteger(Record.Type, "Type"));
486
258
  error(IO.mapStringZ(Record.Name, "Name"));
487
258
488
258
  return Error::success();
489
258
}
490
491
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
492
81
                                          VirtualBaseClassRecord &Record) {
493
81
494
81
  error(IO.mapInteger(Record.Attrs.Attrs, "AccessSpecifier"));
495
81
  error(IO.mapInteger(Record.BaseType, "BaseType"));
496
81
  error(IO.mapInteger(Record.VBPtrType, "VBPtrType"));
497
81
  error(IO.mapEncodedInteger(Record.VBPtrOffset, "VBPtrOffset"));
498
81
  error(IO.mapEncodedInteger(Record.VTableIndex, "VBTableIndex"));
499
81
500
81
  return Error::success();
501
81
}
502
503
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
504
112
                                          VFPtrRecord &Record) {
505
112
  uint16_t Padding = 0;
506
112
  error(IO.mapInteger(Padding, "Padding"));
507
112
  error(IO.mapInteger(Record.Type, "Type"));
508
112
509
112
  return Error::success();
510
112
}
511
512
Error TypeRecordMapping::visitKnownMember(CVMemberRecord &CVR,
513
30
                                          ListContinuationRecord &Record) {
514
30
  uint16_t Padding = 0;
515
30
  error(IO.mapInteger(Padding, "Padding"));
516
30
  error(IO.mapInteger(Record.ContinuationIndex, "ContinuationIndex"));
517
30
518
30
  return Error::success();
519
30
}
520
521
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
522
12
                                          PrecompRecord &Precomp) {
523
12
  error(IO.mapInteger(Precomp.StartTypeIndex, "StartIndex"));
524
12
  error(IO.mapInteger(Precomp.TypesCount, "Count"));
525
12
  error(IO.mapInteger(Precomp.Signature, "Signature"));
526
12
  error(IO.mapStringZ(Precomp.PrecompFilePath, "PrecompFile"));
527
12
  return Error::success();
528
12
}
529
530
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
531
8
                                          EndPrecompRecord &EndPrecomp) {
532
8
  error(IO.mapInteger(EndPrecomp.Signature, "Signature"));
533
8
  return Error::success();
534
8
}