LLVM  7.0.0svn
TypeRecord.h
Go to the documentation of this file.
1 //===- TypeRecord.h ---------------------------------------------*- 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 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H
12 
13 #include "llvm/ADT/APSInt.h"
14 #include "llvm/ADT/ArrayRef.h"
15 #include "llvm/ADT/Optional.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/ADT/StringRef.h"
24 #include "llvm/Support/Endian.h"
25 #include <algorithm>
26 #include <cstdint>
27 #include <vector>
28 
29 namespace llvm {
30 namespace codeview {
31 
35 
38 
42 };
45 
46 /// Equvalent to CV_fldattr_t in cvinfo.h.
48  uint16_t Attrs = 0;
49 
50  enum {
51  MethodKindShift = 2,
52  };
53 
54  MemberAttributes() = default;
55 
56  explicit MemberAttributes(MemberAccess Access)
57  : Attrs(static_cast<uint16_t>(Access)) {}
58 
60  Attrs = static_cast<uint16_t>(Access);
61  Attrs |= (static_cast<uint16_t>(Kind) << MethodKindShift);
62  Attrs |= static_cast<uint16_t>(Flags);
63  }
64 
65  /// Get the access specifier. Valid for any kind of member.
67  return MemberAccess(unsigned(Attrs) & unsigned(MethodOptions::AccessMask));
68  }
69 
70  /// Indicates if a method is defined with friend, virtual, static, etc.
72  return MethodKind(
73  (unsigned(Attrs) & unsigned(MethodOptions::MethodKindMask)) >>
74  MethodKindShift);
75  }
76 
77  /// Get the flags that are not included in access control or method
78  /// properties.
80  return MethodOptions(
81  unsigned(Attrs) &
83  }
84 
85  /// Is this method virtual.
86  bool isVirtual() const {
87  auto MP = getMethodKind();
88  return MP != MethodKind::Vanilla && MP != MethodKind::Friend &&
89  MP != MethodKind::Static;
90  }
91 
92  /// Does this member introduce a new virtual method.
93  bool isIntroducedVirtual() const {
94  auto MP = getMethodKind();
95  return MP == MethodKind::IntroducingVirtual ||
97  }
98 };
99 
100 // Does not correspond to any tag, this is the tail of an LF_POINTER record
101 // if it represents a member pointer.
103 public:
104  MemberPointerInfo() = default;
105 
106  MemberPointerInfo(TypeIndex ContainingType,
107  PointerToMemberRepresentation Representation)
108  : ContainingType(ContainingType), Representation(Representation) {}
109 
110  TypeIndex getContainingType() const { return ContainingType; }
112  return Representation;
113  }
114 
117 };
118 
119 class TypeRecord {
120 protected:
121  TypeRecord() = default;
122  explicit TypeRecord(TypeRecordKind Kind) : Kind(Kind) {}
123 
124 public:
125  TypeRecordKind getKind() const { return Kind; }
126 
128 };
129 
130 // LF_MODIFIER
131 class ModifierRecord : public TypeRecord {
132 public:
133  ModifierRecord() = default;
135  ModifierRecord(TypeIndex ModifiedType, ModifierOptions Modifiers)
136  : TypeRecord(TypeRecordKind::Modifier), ModifiedType(ModifiedType),
137  Modifiers(Modifiers) {}
138 
139  TypeIndex getModifiedType() const { return ModifiedType; }
140  ModifierOptions getModifiers() const { return Modifiers; }
141 
144 };
145 
146 // LF_PROCEDURE
147 class ProcedureRecord : public TypeRecord {
148 public:
149  ProcedureRecord() = default;
152  FunctionOptions Options, uint16_t ParameterCount,
153  TypeIndex ArgumentList)
154  : TypeRecord(TypeRecordKind::Procedure), ReturnType(ReturnType),
155  CallConv(CallConv), Options(Options), ParameterCount(ParameterCount),
156  ArgumentList(ArgumentList) {}
157 
158  TypeIndex getReturnType() const { return ReturnType; }
159  CallingConvention getCallConv() const { return CallConv; }
160  FunctionOptions getOptions() const { return Options; }
161  uint16_t getParameterCount() const { return ParameterCount; }
162  TypeIndex getArgumentList() const { return ArgumentList; }
163 
167  uint16_t ParameterCount;
169 };
170 
171 // LF_MFUNCTION
173 public:
174  MemberFunctionRecord() = default;
176 
178  TypeIndex ThisType, CallingConvention CallConv,
179  FunctionOptions Options, uint16_t ParameterCount,
180  TypeIndex ArgumentList, int32_t ThisPointerAdjustment)
181  : TypeRecord(TypeRecordKind::MemberFunction), ReturnType(ReturnType),
182  ClassType(ClassType), ThisType(ThisType), CallConv(CallConv),
183  Options(Options), ParameterCount(ParameterCount),
184  ArgumentList(ArgumentList),
185  ThisPointerAdjustment(ThisPointerAdjustment) {}
186 
187  TypeIndex getReturnType() const { return ReturnType; }
188  TypeIndex getClassType() const { return ClassType; }
189  TypeIndex getThisType() const { return ThisType; }
190  CallingConvention getCallConv() const { return CallConv; }
191  FunctionOptions getOptions() const { return Options; }
192  uint16_t getParameterCount() const { return ParameterCount; }
193  TypeIndex getArgumentList() const { return ArgumentList; }
194  int32_t getThisPointerAdjustment() const { return ThisPointerAdjustment; }
195 
201  uint16_t ParameterCount;
204 };
205 
206 // LF_LABEL
207 class LabelRecord : public TypeRecord {
208 public:
209  LabelRecord() = default;
211 
213 
215 };
216 
217 // LF_MFUNC_ID
219 public:
220  MemberFuncIdRecord() = default;
223  StringRef Name)
224  : TypeRecord(TypeRecordKind::MemberFuncId), ClassType(ClassType),
225  FunctionType(FunctionType), Name(Name) {}
226 
227  TypeIndex getClassType() const { return ClassType; }
229  StringRef getName() const { return Name; }
230 
234 };
235 
236 // LF_ARGLIST
237 class ArgListRecord : public TypeRecord {
238 public:
239  ArgListRecord() = default;
241 
243  : TypeRecord(Kind), ArgIndices(Indices) {}
244 
245  ArrayRef<TypeIndex> getIndices() const { return ArgIndices; }
246 
247  std::vector<TypeIndex> ArgIndices;
248 };
249 
250 // LF_SUBSTR_LIST
251 class StringListRecord : public TypeRecord {
252 public:
253  StringListRecord() = default;
255 
257  : TypeRecord(Kind), StringIndices(Indices) {}
258 
259  ArrayRef<TypeIndex> getIndices() const { return StringIndices; }
260 
261  std::vector<TypeIndex> StringIndices;
262 };
263 
264 // LF_POINTER
265 class PointerRecord : public TypeRecord {
266 public:
267  static const uint32_t PointerKindShift = 0;
268  static const uint32_t PointerKindMask = 0x1F;
269 
270  static const uint32_t PointerModeShift = 5;
271  static const uint32_t PointerModeMask = 0x07;
272 
273  static const uint32_t PointerOptionMask = 0xFF;
274 
275  static const uint32_t PointerSizeShift = 13;
276  static const uint32_t PointerSizeMask = 0xFF;
277 
278  PointerRecord() = default;
280 
282  : TypeRecord(TypeRecordKind::Pointer), ReferentType(ReferentType),
283  Attrs(Attrs) {}
284 
286  PointerOptions PO, uint8_t Size)
287  : TypeRecord(TypeRecordKind::Pointer), ReferentType(ReferentType),
288  Attrs(calcAttrs(PK, PM, PO, Size)) {}
289 
291  PointerOptions PO, uint8_t Size, const MemberPointerInfo &MPI)
292  : TypeRecord(TypeRecordKind::Pointer), ReferentType(ReferentType),
293  Attrs(calcAttrs(PK, PM, PO, Size)), MemberInfo(MPI) {}
294 
295  TypeIndex getReferentType() const { return ReferentType; }
296 
298  return static_cast<PointerKind>((Attrs >> PointerKindShift) &
299  PointerKindMask);
300  }
301 
303  return static_cast<PointerMode>((Attrs >> PointerModeShift) &
304  PointerModeMask);
305  }
306 
308  return static_cast<PointerOptions>(Attrs);
309  }
310 
311  uint8_t getSize() const {
312  return (Attrs >> PointerSizeShift) & PointerSizeMask;
313  }
314 
315  MemberPointerInfo getMemberInfo() const { return *MemberInfo; }
316 
317  bool isPointerToMember() const {
318  return getMode() == PointerMode::PointerToDataMember ||
320  }
321 
322  bool isFlat() const { return !!(Attrs & uint32_t(PointerOptions::Flat32)); }
323  bool isConst() const { return !!(Attrs & uint32_t(PointerOptions::Const)); }
324 
325  bool isVolatile() const {
327  }
328 
329  bool isUnaligned() const {
331  }
332 
336 
338  uint8_t Size) {
339  Attrs = calcAttrs(PK, PM, PO, Size);
340  }
341 
342 private:
343  static uint32_t calcAttrs(PointerKind PK, PointerMode PM, PointerOptions PO,
344  uint8_t Size) {
345  uint32_t A = 0;
346  A |= static_cast<uint32_t>(PK);
347  A |= static_cast<uint32_t>(PO);
348  A |= (static_cast<uint32_t>(PM) << PointerModeShift);
349  A |= (static_cast<uint32_t>(Size) << PointerSizeShift);
350  return A;
351  }
352 };
353 
354 // LF_NESTTYPE
355 class NestedTypeRecord : public TypeRecord {
356 public:
357  NestedTypeRecord() = default;
360  : TypeRecord(TypeRecordKind::NestedType), Type(Type), Name(Name) {}
361 
362  TypeIndex getNestedType() const { return Type; }
363  StringRef getName() const { return Name; }
364 
367 };
368 
369 // LF_FIELDLIST
370 class FieldListRecord : public TypeRecord {
371 public:
372  FieldListRecord() = default;
375  : TypeRecord(TypeRecordKind::FieldList), Data(Data) {}
376 
378 };
379 
380 // LF_ARRAY
381 class ArrayRecord : public TypeRecord {
382 public:
383  ArrayRecord() = default;
385  ArrayRecord(TypeIndex ElementType, TypeIndex IndexType, uint64_t Size,
386  StringRef Name)
387  : TypeRecord(TypeRecordKind::Array), ElementType(ElementType),
388  IndexType(IndexType), Size(Size), Name(Name) {}
389 
390  TypeIndex getElementType() const { return ElementType; }
391  TypeIndex getIndexType() const { return IndexType; }
392  uint64_t getSize() const { return Size; }
393  StringRef getName() const { return Name; }
394 
397  uint64_t Size;
399 };
400 
401 class TagRecord : public TypeRecord {
402 protected:
403  TagRecord() = default;
405  TagRecord(TypeRecordKind Kind, uint16_t MemberCount, ClassOptions Options,
407  : TypeRecord(Kind), MemberCount(MemberCount), Options(Options),
408  FieldList(FieldList), Name(Name), UniqueName(UniqueName) {}
409 
410 public:
411  static const int HfaKindShift = 11;
412  static const int HfaKindMask = 0x1800;
413  static const int WinRTKindShift = 14;
414  static const int WinRTKindMask = 0xC000;
415 
416  bool hasUniqueName() const {
417  return (Options & ClassOptions::HasUniqueName) != ClassOptions::None;
418  }
419 
420  bool isNested() const {
421  return (Options & ClassOptions::Nested) != ClassOptions::None;
422  }
423 
424  bool isForwardRef() const {
426  }
427 
428  uint16_t getMemberCount() const { return MemberCount; }
429  ClassOptions getOptions() const { return Options; }
430  TypeIndex getFieldList() const { return FieldList; }
431  StringRef getName() const { return Name; }
432  StringRef getUniqueName() const { return UniqueName; }
433 
434  uint16_t MemberCount;
439 };
440 
441 // LF_CLASS, LF_STRUCTURE, LF_INTERFACE
442 class ClassRecord : public TagRecord {
443 public:
444  ClassRecord() = default;
446  ClassRecord(TypeRecordKind Kind, uint16_t MemberCount, ClassOptions Options,
447  TypeIndex FieldList, TypeIndex DerivationList,
448  TypeIndex VTableShape, uint64_t Size, StringRef Name,
449  StringRef UniqueName)
450  : TagRecord(Kind, MemberCount, Options, FieldList, Name, UniqueName),
451  DerivationList(DerivationList), VTableShape(VTableShape), Size(Size) {}
452 
453  HfaKind getHfa() const {
454  uint16_t Value = static_cast<uint16_t>(Options);
455  Value = (Value & HfaKindMask) >> HfaKindShift;
456  return static_cast<HfaKind>(Value);
457  }
458 
460  uint16_t Value = static_cast<uint16_t>(Options);
461  Value = (Value & WinRTKindMask) >> WinRTKindShift;
462  return static_cast<WindowsRTClassKind>(Value);
463  }
464 
465  TypeIndex getDerivationList() const { return DerivationList; }
466  TypeIndex getVTableShape() const { return VTableShape; }
467  uint64_t getSize() const { return Size; }
468 
471  uint64_t Size;
472 };
473 
474 // LF_UNION
475 struct UnionRecord : public TagRecord {
476  UnionRecord() = default;
478  UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,
479  uint64_t Size, StringRef Name, StringRef UniqueName)
480  : TagRecord(TypeRecordKind::Union, MemberCount, Options, FieldList, Name,
481  UniqueName),
482  Size(Size) {}
483 
484  HfaKind getHfa() const {
485  uint16_t Value = static_cast<uint16_t>(Options);
486  Value = (Value & HfaKindMask) >> HfaKindShift;
487  return static_cast<HfaKind>(Value);
488  }
489 
490  uint64_t getSize() const { return Size; }
491 
492  uint64_t Size;
493 };
494 
495 // LF_ENUM
496 class EnumRecord : public TagRecord {
497 public:
498  EnumRecord() = default;
500  EnumRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,
501  StringRef Name, StringRef UniqueName, TypeIndex UnderlyingType)
502  : TagRecord(TypeRecordKind::Enum, MemberCount, Options, FieldList, Name,
503  UniqueName),
504  UnderlyingType(UnderlyingType) {}
505 
506  TypeIndex getUnderlyingType() const { return UnderlyingType; }
507 
509 };
510 
511 // LF_BITFIELD
512 class BitFieldRecord : public TypeRecord {
513 public:
514  BitFieldRecord() = default;
516  BitFieldRecord(TypeIndex Type, uint8_t BitSize, uint8_t BitOffset)
517  : TypeRecord(TypeRecordKind::BitField), Type(Type), BitSize(BitSize),
518  BitOffset(BitOffset) {}
519 
520  TypeIndex getType() const { return Type; }
521  uint8_t getBitOffset() const { return BitOffset; }
522  uint8_t getBitSize() const { return BitSize; }
523 
525  uint8_t BitSize;
526  uint8_t BitOffset;
527 };
528 
529 // LF_VTSHAPE
531 public:
532  VFTableShapeRecord() = default;
535  : TypeRecord(TypeRecordKind::VFTableShape), SlotsRef(Slots) {}
536  explicit VFTableShapeRecord(std::vector<VFTableSlotKind> Slots)
537  : TypeRecord(TypeRecordKind::VFTableShape), Slots(std::move(Slots)) {}
538 
540  if (!SlotsRef.empty())
541  return SlotsRef;
542  return Slots;
543  }
544 
545  uint32_t getEntryCount() const { return getSlots().size(); }
546 
548  std::vector<VFTableSlotKind> Slots;
549 };
550 
551 // LF_TYPESERVER2
553 public:
554  TypeServer2Record() = default;
557  : TypeRecord(TypeRecordKind::TypeServer2), Age(Age), Name(Name) {
558  assert(GuidStr.size() == 16 && "guid isn't 16 bytes");
559  ::memcpy(Guid.Guid, GuidStr.data(), 16);
560  }
561 
562  const GUID &getGuid() const { return Guid; }
563  uint32_t getAge() const { return Age; }
564  StringRef getName() const { return Name; }
565 
569 };
570 
571 // LF_STRING_ID
572 class StringIdRecord : public TypeRecord {
573 public:
574  StringIdRecord() = default;
577  : TypeRecord(TypeRecordKind::StringId), Id(Id), String(String) {}
578 
579  TypeIndex getId() const { return Id; }
580  StringRef getString() const { return String; }
581 
584 };
585 
586 // LF_FUNC_ID
587 class FuncIdRecord : public TypeRecord {
588 public:
589  FuncIdRecord() = default;
592  : TypeRecord(TypeRecordKind::FuncId), ParentScope(ParentScope),
593  FunctionType(FunctionType), Name(Name) {}
594 
595  TypeIndex getParentScope() const { return ParentScope; }
597  StringRef getName() const { return Name; }
598 
602 };
603 
604 // LF_UDT_SRC_LINE
606 public:
607  UdtSourceLineRecord() = default;
609  UdtSourceLineRecord(TypeIndex UDT, TypeIndex SourceFile, uint32_t LineNumber)
610  : TypeRecord(TypeRecordKind::UdtSourceLine), UDT(UDT),
611  SourceFile(SourceFile), LineNumber(LineNumber) {}
612 
613  TypeIndex getUDT() const { return UDT; }
614  TypeIndex getSourceFile() const { return SourceFile; }
615  uint32_t getLineNumber() const { return LineNumber; }
616 
620 };
621 
622 // LF_UDT_MOD_SRC_LINE
624 public:
625  UdtModSourceLineRecord() = default;
628  uint32_t LineNumber, uint16_t Module)
629  : TypeRecord(TypeRecordKind::UdtSourceLine), UDT(UDT),
630  SourceFile(SourceFile), LineNumber(LineNumber), Module(Module) {}
631 
632  TypeIndex getUDT() const { return UDT; }
633  TypeIndex getSourceFile() const { return SourceFile; }
634  uint32_t getLineNumber() const { return LineNumber; }
635  uint16_t getModule() const { return Module; }
636 
640  uint16_t Module;
641 };
642 
643 // LF_BUILDINFO
644 class BuildInfoRecord : public TypeRecord {
645 public:
646  BuildInfoRecord() = default;
649  : TypeRecord(TypeRecordKind::BuildInfo),
650  ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
651 
652  ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
653 
655 };
656 
657 // LF_VFTABLE
658 class VFTableRecord : public TypeRecord {
659 public:
660  VFTableRecord() = default;
662  VFTableRecord(TypeIndex CompleteClass, TypeIndex OverriddenVFTable,
663  uint32_t VFPtrOffset, StringRef Name,
664  ArrayRef<StringRef> Methods)
665  : TypeRecord(TypeRecordKind::VFTable), CompleteClass(CompleteClass),
666  OverriddenVFTable(OverriddenVFTable), VFPtrOffset(VFPtrOffset) {
667  MethodNames.push_back(Name);
668  MethodNames.insert(MethodNames.end(), Methods.begin(), Methods.end());
669  }
670 
671  TypeIndex getCompleteClass() const { return CompleteClass; }
672  TypeIndex getOverriddenVTable() const { return OverriddenVFTable; }
673  uint32_t getVFPtrOffset() const { return VFPtrOffset; }
674  StringRef getName() const { return makeArrayRef(MethodNames).front(); }
675 
677  return makeArrayRef(MethodNames).drop_front();
678  }
679 
683  std::vector<StringRef> MethodNames;
684 };
685 
686 // LF_ONEMETHOD
687 class OneMethodRecord : public TypeRecord {
688 public:
689  OneMethodRecord() = default;
692  StringRef Name)
693  : TypeRecord(TypeRecordKind::OneMethod), Type(Type), Attrs(Attrs),
694  VFTableOffset(VFTableOffset), Name(Name) {}
696  MethodOptions Options, int32_t VFTableOffset, StringRef Name)
697  : TypeRecord(TypeRecordKind::OneMethod), Type(Type),
698  Attrs(Access, MK, Options), VFTableOffset(VFTableOffset), Name(Name) {}
699 
700  TypeIndex getType() const { return Type; }
701  MethodKind getMethodKind() const { return Attrs.getMethodKind(); }
702  MethodOptions getOptions() const { return Attrs.getFlags(); }
703  MemberAccess getAccess() const { return Attrs.getAccess(); }
704  int32_t getVFTableOffset() const { return VFTableOffset; }
705  StringRef getName() const { return Name; }
706 
707  bool isIntroducingVirtual() const {
710  }
711 
714  int32_t VFTableOffset;
716 };
717 
718 // LF_METHODLIST
720 public:
721  MethodOverloadListRecord() = default;
724  : TypeRecord(TypeRecordKind::MethodOverloadList), Methods(Methods) {}
725 
726  ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
727 
728  std::vector<OneMethodRecord> Methods;
729 };
730 
731 /// For method overload sets. LF_METHOD
733 public:
734  OverloadedMethodRecord() = default;
736  OverloadedMethodRecord(uint16_t NumOverloads, TypeIndex MethodList,
737  StringRef Name)
738  : TypeRecord(TypeRecordKind::OverloadedMethod),
739  NumOverloads(NumOverloads), MethodList(MethodList), Name(Name) {}
740 
741  uint16_t getNumOverloads() const { return NumOverloads; }
742  TypeIndex getMethodList() const { return MethodList; }
743  StringRef getName() const { return Name; }
744 
745  uint16_t NumOverloads;
748 };
749 
750 // LF_MEMBER
751 class DataMemberRecord : public TypeRecord {
752 public:
753  DataMemberRecord() = default;
756  StringRef Name)
757  : TypeRecord(TypeRecordKind::DataMember), Attrs(Attrs), Type(Type),
758  FieldOffset(Offset), Name(Name) {}
760  StringRef Name)
761  : TypeRecord(TypeRecordKind::DataMember), Attrs(Access), Type(Type),
762  FieldOffset(Offset), Name(Name) {}
763 
764  MemberAccess getAccess() const { return Attrs.getAccess(); }
765  TypeIndex getType() const { return Type; }
766  uint64_t getFieldOffset() const { return FieldOffset; }
767  StringRef getName() const { return Name; }
768 
771  uint64_t FieldOffset;
773 };
774 
775 // LF_STMEMBER
777 public:
778  StaticDataMemberRecord() = default;
781  : TypeRecord(TypeRecordKind::StaticDataMember), Attrs(Attrs), Type(Type),
782  Name(Name) {}
784  : TypeRecord(TypeRecordKind::StaticDataMember), Attrs(Access), Type(Type),
785  Name(Name) {}
786 
787  MemberAccess getAccess() const { return Attrs.getAccess(); }
788  TypeIndex getType() const { return Type; }
789  StringRef getName() const { return Name; }
790 
794 };
795 
796 // LF_ENUMERATE
797 class EnumeratorRecord : public TypeRecord {
798 public:
799  EnumeratorRecord() = default;
802  : TypeRecord(TypeRecordKind::Enumerator), Attrs(Attrs),
803  Value(std::move(Value)), Name(Name) {}
806  Value(std::move(Value)), Name(Name) {}
807 
808  MemberAccess getAccess() const { return Attrs.getAccess(); }
809  APSInt getValue() const { return Value; }
810  StringRef getName() const { return Name; }
811 
815 };
816 
817 // LF_VFUNCTAB
818 class VFPtrRecord : public TypeRecord {
819 public:
820  VFPtrRecord() = default;
823  : TypeRecord(TypeRecordKind::VFPtr), Type(Type) {}
824 
825  TypeIndex getType() const { return Type; }
826 
828 };
829 
830 // LF_BCLASS, LF_BINTERFACE
831 class BaseClassRecord : public TypeRecord {
832 public:
833  BaseClassRecord() = default;
836  : TypeRecord(TypeRecordKind::BaseClass), Attrs(Attrs), Type(Type),
837  Offset(Offset) {}
839  : TypeRecord(TypeRecordKind::BaseClass), Attrs(Access), Type(Type),
840  Offset(Offset) {}
841 
842  MemberAccess getAccess() const { return Attrs.getAccess(); }
843  TypeIndex getBaseType() const { return Type; }
844  uint64_t getBaseOffset() const { return Offset; }
845 
848  uint64_t Offset;
849 };
850 
851 // LF_VBCLASS, LF_IVBCLASS
853 public:
854  VirtualBaseClassRecord() = default;
857  TypeIndex BaseType, TypeIndex VBPtrType,
858  uint64_t Offset, uint64_t Index)
859  : TypeRecord(Kind), Attrs(Attrs), BaseType(BaseType),
860  VBPtrType(VBPtrType), VBPtrOffset(Offset), VTableIndex(Index) {}
862  TypeIndex BaseType, TypeIndex VBPtrType,
863  uint64_t Offset, uint64_t Index)
864  : TypeRecord(Kind), Attrs(Access), BaseType(BaseType),
865  VBPtrType(VBPtrType), VBPtrOffset(Offset), VTableIndex(Index) {}
866 
867  MemberAccess getAccess() const { return Attrs.getAccess(); }
868  TypeIndex getBaseType() const { return BaseType; }
869  TypeIndex getVBPtrType() const { return VBPtrType; }
870  uint64_t getVBPtrOffset() const { return VBPtrOffset; }
871  uint64_t getVTableIndex() const { return VTableIndex; }
872 
876  uint64_t VBPtrOffset;
877  uint64_t VTableIndex;
878 };
879 
880 /// LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST records
881 /// together. The first will end in an LF_INDEX record that points to the next.
883 public:
884  ListContinuationRecord() = default;
887  : TypeRecord(TypeRecordKind::ListContinuation),
888  ContinuationIndex(ContinuationIndex) {}
889 
890  TypeIndex getContinuationIndex() const { return ContinuationIndex; }
891 
893 };
894 
895 } // end namespace codeview
896 } // end namespace llvm
897 
898 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H
MemberAccess getAccess() const
Definition: TypeRecord.h:808
PointerKind
Equivalent to CV_ptrtype_e.
Definition: CodeView.h:326
TypeIndex getIndexType() const
Definition: TypeRecord.h:391
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:245
int32_t getThisPointerAdjustment() const
Definition: TypeRecord.h:194
UdtSourceLineRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:608
MemberAttributes(MemberAccess Access)
Definition: TypeRecord.h:56
VirtualBaseClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:855
uint16_t getMemberCount() const
Definition: TypeRecord.h:428
uint64_t getSize() const
Definition: TypeRecord.h:392
BuildInfoRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:647
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:236
MemberFunctionRecord(TypeIndex ReturnType, TypeIndex ClassType, TypeIndex ThisType, CallingConvention CallConv, FunctionOptions Options, uint16_t ParameterCount, TypeIndex ArgumentList, int32_t ThisPointerAdjustment)
Definition: TypeRecord.h:177
SI Whole Quad Mode
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
uint64_t getSize() const
Definition: TypeRecord.h:467
LabelRecord(LabelType Mode)
Definition: TypeRecord.h:212
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
Definition: CodeView.h:34
TagRecord(TypeRecordKind Kind, uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList, StringRef Name, StringRef UniqueName)
Definition: TypeRecord.h:405
MethodOverloadListRecord(ArrayRef< OneMethodRecord > Methods)
Definition: TypeRecord.h:723
iterator begin() const
Definition: ArrayRef.h:137
StaticDataMemberRecord(MemberAttributes Attrs, TypeIndex Type, StringRef Name)
Definition: TypeRecord.h:780
ArrayRef< uint8_t > Data
Definition: TypeRecord.h:41
VirtualBaseClassRecord(TypeRecordKind Kind, MemberAttributes Attrs, TypeIndex BaseType, TypeIndex VBPtrType, uint64_t Offset, uint64_t Index)
Definition: TypeRecord.h:856
TypeIndex getBaseType() const
Definition: TypeRecord.h:843
ArrayRef< StringRef > getMethodNames() const
Definition: TypeRecord.h:676
MemberAccess getAccess() const
Definition: TypeRecord.h:703
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Definition: StringRef.h:138
StringIdRecord(TypeIndex Id, StringRef String)
Definition: TypeRecord.h:576
BuildInfoRecord(ArrayRef< TypeIndex > ArgIndices)
Definition: TypeRecord.h:648
NestedTypeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:358
OverloadedMethodRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:735
TypeIndex getReferentType() const
Definition: TypeRecord.h:295
MemberPointerInfo getMemberInfo() const
Definition: TypeRecord.h:315
PointerRecord(TypeIndex ReferentType, uint32_t Attrs)
Definition: TypeRecord.h:281
ClassRecord(TypeRecordKind Kind, uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList, TypeIndex DerivationList, TypeIndex VTableShape, uint64_t Size, StringRef Name, StringRef UniqueName)
Definition: TypeRecord.h:446
TypeIndex getType() const
Definition: TypeRecord.h:520
FieldListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:373
FieldListRecord(ArrayRef< uint8_t > Data)
Definition: TypeRecord.h:374
ArrayRef< uint8_t > Data
Definition: TypeRecord.h:377
TypeServer2Record(StringRef GuidStr, uint32_t Age, StringRef Name)
Definition: TypeRecord.h:556
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
Definition: Endian.h:269
TypeServer2Record(TypeRecordKind Kind)
Definition: TypeRecord.h:555
BitFieldRecord(TypeIndex Type, uint8_t BitSize, uint8_t BitOffset)
Definition: TypeRecord.h:516
WindowsRTClassKind getWinRTKind() const
Definition: TypeRecord.h:459
OneMethodRecord(TypeIndex Type, MemberAttributes Attrs, int32_t VFTableOffset, StringRef Name)
Definition: TypeRecord.h:691
BitFieldRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:515
ArgListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:240
MethodKind getMethodKind() const
Definition: TypeRecord.h:701
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:128
OneMethodRecord(TypeIndex Type, MemberAccess Access, MethodKind MK, MethodOptions Options, int32_t VFTableOffset, StringRef Name)
Definition: TypeRecord.h:695
TypeIndex getFunctionType() const
Definition: TypeRecord.h:228
EnumRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList, StringRef Name, StringRef UniqueName, TypeIndex UnderlyingType)
Definition: TypeRecord.h:500
MemberFunctionRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:175
bool isForwardRef() const
Definition: TypeRecord.h:424
PointerRecord(TypeIndex ReferentType, PointerKind PK, PointerMode PM, PointerOptions PO, uint8_t Size)
Definition: TypeRecord.h:285
StringRef getName() const
Definition: TypeRecord.h:431
bool hasUniqueName() const
Definition: TypeRecord.h:416
DataMemberRecord(MemberAttributes Attrs, TypeIndex Type, uint64_t Offset, StringRef Name)
Definition: TypeRecord.h:755
ArgListRecord(TypeRecordKind Kind, ArrayRef< TypeIndex > Indices)
Definition: TypeRecord.h:242
Definition: BitVector.h:921
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:451
StringRef getName() const
Definition: TypeRecord.h:597
StringRef getName() const
Definition: TypeRecord.h:393
ArrayRef< VFTableSlotKind > SlotsRef
Definition: TypeRecord.h:547
This represents the &#39;GUID&#39; type from windows.h.
Definition: GUID.h:22
LabelRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:210
uint64_t getBaseOffset() const
Definition: TypeRecord.h:844
Class to represent function types.
Definition: DerivedTypes.h:103
VirtualBaseClassRecord(TypeRecordKind Kind, MemberAccess Access, TypeIndex BaseType, TypeIndex VBPtrType, uint64_t Offset, uint64_t Index)
Definition: TypeRecord.h:861
OneMethodRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:690
ClassOptions getOptions() const
Definition: TypeRecord.h:429
ModifierOptions
Equivalent to CV_modifier_t.
Definition: CodeView.h:297
static MethodKind getMethodKind(uint16_t Attrs)
TypeIndex getFunctionType() const
Definition: TypeRecord.h:596
LabelType
Equivalent to CV_LABEL_TYPE_e.
Definition: CodeView.h:290
PointerRecord(TypeIndex ReferentType, PointerKind PK, PointerMode PM, PointerOptions PO, uint8_t Size, const MemberPointerInfo &MPI)
Definition: TypeRecord.h:290
PointerMode getMode() const
Definition: TypeRecord.h:302
A 32-bit type reference.
Definition: TypeIndex.h:96
UdtSourceLineRecord(TypeIndex UDT, TypeIndex SourceFile, uint32_t LineNumber)
Definition: TypeRecord.h:609
TypeIndex getElementType() const
Definition: TypeRecord.h:390
TypeIndex getReturnType() const
Definition: TypeRecord.h:158
CallingConvention getCallConv() const
Definition: TypeRecord.h:190
std::vector< TypeIndex > StringIndices
Definition: TypeRecord.h:261
VFTableRecord(TypeIndex CompleteClass, TypeIndex OverriddenVFTable, uint32_t VFPtrOffset, StringRef Name, ArrayRef< StringRef > Methods)
Definition: TypeRecord.h:662
MemberAccess getAccess() const
Definition: TypeRecord.h:764
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
MethodKind
Part of member attribute flags. (CV_methodprop_e)
Definition: CodeView.h:266
ModifierRecord(TypeIndex ModifiedType, ModifierOptions Modifiers)
Definition: TypeRecord.h:135
ModifierRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:134
EnumeratorRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:800
TypeIndex getFieldList() const
Definition: TypeRecord.h:430
StringRef getString() const
Definition: TypeRecord.h:580
ArrayRef< TypeIndex > getArgs() const
Definition: TypeRecord.h:652
VFTableRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:661
TypeRecordKind
Distinguishes individual records in .debug$T section or PDB type stream.
Definition: CodeView.h:27
PointerToMemberRepresentation getRepresentation() const
Definition: TypeRecord.h:111
ListContinuationRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:885
FunctionOptions getOptions() const
Definition: TypeRecord.h:191
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Definition: Endian.h:271
PointerRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:279
uint32_t getVFPtrOffset() const
Definition: TypeRecord.h:673
bool isIntroducedVirtual() const
Does this member introduce a new virtual method.
Definition: TypeRecord.h:93
Optional< MemberPointerInfo > MemberInfo
Definition: TypeRecord.h:335
NestedTypeRecord(TypeIndex Type, StringRef Name)
Definition: TypeRecord.h:359
LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST records together.
Definition: TypeRecord.h:882
StringRef getUniqueName() const
Definition: TypeRecord.h:432
TypeIndex getContainingType() const
Definition: TypeRecord.h:110
std::vector< TypeIndex > ArgIndices
Definition: TypeRecord.h:247
FuncIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:590
StringListRecord(TypeRecordKind Kind, ArrayRef< TypeIndex > Indices)
Definition: TypeRecord.h:256
TagRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:404
For method overload sets. LF_METHOD.
Definition: TypeRecord.h:732
OverloadedMethodRecord(uint16_t NumOverloads, TypeIndex MethodList, StringRef Name)
Definition: TypeRecord.h:736
TypeIndex getArgumentList() const
Definition: TypeRecord.h:162
FuncIdRecord(TypeIndex ParentScope, TypeIndex FunctionType, StringRef Name)
Definition: TypeRecord.h:591
MethodOptions getOptions() const
Definition: TypeRecord.h:702
PointerKind getPointerKind() const
Definition: TypeRecord.h:297
std::vector< StringRef > MethodNames
Definition: TypeRecord.h:683
ArrayRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:384
TypeIndex getUnderlyingType() const
Definition: TypeRecord.h:506
UdtModSourceLineRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:626
BaseClassRecord(MemberAttributes Attrs, TypeIndex Type, uint64_t Offset)
Definition: TypeRecord.h:835
ListContinuationRecord(TypeIndex ContinuationIndex)
Definition: TypeRecord.h:886
StringListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:254
uint64_t getSize() const
Definition: TypeRecord.h:490
ProcedureRecord(TypeIndex ReturnType, CallingConvention CallConv, FunctionOptions Options, uint16_t ParameterCount, TypeIndex ArgumentList)
Definition: TypeRecord.h:151
PointerOptions
Equivalent to misc lfPointerAttr bitfields.
Definition: CodeView.h:352
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
MethodOverloadListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:722
int32_t getVFTableOffset() const
Definition: TypeRecord.h:704
UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList, uint64_t Size, StringRef Name, StringRef UniqueName)
Definition: TypeRecord.h:478
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:862
StaticDataMemberRecord(MemberAccess Access, TypeIndex Type, StringRef Name)
Definition: TypeRecord.h:783
TypeIndex getVTableShape() const
Definition: TypeRecord.h:466
CallingConvention CallConv
Definition: TypeRecord.h:165
MethodKind getMethodKind() const
Indicates if a method is defined with friend, virtual, static, etc.
Definition: TypeRecord.h:71
iterator end() const
Definition: ArrayRef.h:138
MemberAccess getAccess() const
Definition: TypeRecord.h:842
DataMemberRecord(MemberAccess Access, TypeIndex Type, uint64_t Offset, StringRef Name)
Definition: TypeRecord.h:759
HfaKind getHfa() const
Definition: TypeRecord.h:484
EnumeratorRecord(MemberAccess Access, APSInt Value, StringRef Name)
Definition: TypeRecord.h:804
TypeIndex getOverriddenVTable() const
Definition: TypeRecord.h:672
TypeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:122
ArrayRef< OneMethodRecord > getMethods() const
Definition: TypeRecord.h:726
PointerMode
Equivalent to CV_ptrmode_e.
Definition: CodeView.h:343
VFTableShapeRecord(ArrayRef< VFTableSlotKind > Slots)
Definition: TypeRecord.h:534
A range adaptor for a pair of iterators.
ArrayRef< TypeIndex > getIndices() const
Definition: TypeRecord.h:259
uint8_t getBitOffset() const
Definition: TypeRecord.h:521
TypeIndex getDerivationList() const
Definition: TypeRecord.h:465
TypeIndex getParentScope() const
Definition: TypeRecord.h:595
MemberFuncIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:221
ClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:445
TypeIndex getCompleteClass() const
Definition: TypeRecord.h:671
MethodOptions
Equivalent to CV_fldattr_t bitfield.
Definition: CodeView.h:277
bool isVirtual() const
Is this method virtual.
Definition: TypeRecord.h:86
void setAttrs(PointerKind PK, PointerMode PM, PointerOptions PO, uint8_t Size)
Definition: TypeRecord.h:337
std::vector< OneMethodRecord > Methods
Definition: TypeRecord.h:728
TypeIndex getNestedType() const
Definition: TypeRecord.h:362
MemberFuncIdRecord(TypeIndex ClassType, TypeIndex FunctionType, StringRef Name)
Definition: TypeRecord.h:222
const GUID & getGuid() const
Definition: TypeRecord.h:562
VFTableShapeRecord(std::vector< VFTableSlotKind > Slots)
Definition: TypeRecord.h:536
CallingConvention getCallConv() const
Definition: TypeRecord.h:159
SmallVector< TypeIndex, 4 > ArgIndices
Definition: TypeRecord.h:654
detail::packed_endian_specific_integral< int32_t, little, unaligned > little32_t
Definition: Endian.h:278
VFTableShapeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:533
ArrayRef< TypeIndex > getIndices() const
Definition: TypeRecord.h:245
StaticDataMemberRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:779
PointerOptions getOptions() const
Definition: TypeRecord.h:307
ArrayRecord(TypeIndex ElementType, TypeIndex IndexType, uint64_t Size, StringRef Name)
Definition: TypeRecord.h:385
TypeIndex getType() const
Definition: TypeRecord.h:825
FunctionOptions getOptions() const
Definition: TypeRecord.h:160
EnumeratorRecord(MemberAttributes Attrs, APSInt Value, StringRef Name)
Definition: TypeRecord.h:801
PointerToMemberRepresentation
Equivalent to CV_pmtype_e.
Definition: CodeView.h:364
VFPtrRecord(TypeIndex Type)
Definition: TypeRecord.h:822
ProcedureRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:150
StringIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:575
uint16_t getParameterCount() const
Definition: TypeRecord.h:161
MemberAccess
Source-level access specifier. (CV_access_e)
Definition: CodeView.h:258
DataMemberRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:754
uint64_t getFieldOffset() const
Definition: TypeRecord.h:766
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MethodOptions getFlags() const
Get the flags that are not included in access control or method properties.
Definition: TypeRecord.h:79
std::vector< VFTableSlotKind > Slots
Definition: TypeRecord.h:548
BaseClassRecord(MemberAccess Access, TypeIndex Type, uint64_t Offset)
Definition: TypeRecord.h:838
ArrayRef< VFTableSlotKind > getSlots() const
Definition: TypeRecord.h:539
BaseClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:834
Equvalent to CV_fldattr_t in cvinfo.h.
Definition: TypeRecord.h:47
UnionRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:477
LLVM Value Representation.
Definition: Value.h:73
EnumRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:499
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
TypeRecordKind getKind() const
Definition: TypeRecord.h:125
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
Definition: CodeView.h:173
VFPtrRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:821
TypeIndex getModifiedType() const
Definition: TypeRecord.h:139
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
HfaKind getHfa() const
Definition: TypeRecord.h:453
UdtModSourceLineRecord(TypeIndex UDT, TypeIndex SourceFile, uint32_t LineNumber, uint16_t Module)
Definition: TypeRecord.h:627
MemberAccess getAccess() const
Get the access specifier. Valid for any kind of member.
Definition: TypeRecord.h:66
MemberPointerInfo(TypeIndex ContainingType, PointerToMemberRepresentation Representation)
Definition: TypeRecord.h:106
MemberAttributes(MemberAccess Access, MethodKind Kind, MethodOptions Flags)
Definition: TypeRecord.h:59
PointerToMemberRepresentation Representation
Definition: TypeRecord.h:116
StringRef getName() const
Definition: TypeRecord.h:674
ModifierOptions getModifiers() const
Definition: TypeRecord.h:140