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 
333  bool isRestrict() const {
335  }
336 
340 
342  uint8_t Size) {
343  Attrs = calcAttrs(PK, PM, PO, Size);
344  }
345 
346 private:
347  static uint32_t calcAttrs(PointerKind PK, PointerMode PM, PointerOptions PO,
348  uint8_t Size) {
349  uint32_t A = 0;
350  A |= static_cast<uint32_t>(PK);
351  A |= static_cast<uint32_t>(PO);
352  A |= (static_cast<uint32_t>(PM) << PointerModeShift);
353  A |= (static_cast<uint32_t>(Size) << PointerSizeShift);
354  return A;
355  }
356 };
357 
358 // LF_NESTTYPE
359 class NestedTypeRecord : public TypeRecord {
360 public:
361  NestedTypeRecord() = default;
364  : TypeRecord(TypeRecordKind::NestedType), Type(Type), Name(Name) {}
365 
366  TypeIndex getNestedType() const { return Type; }
367  StringRef getName() const { return Name; }
368 
371 };
372 
373 // LF_FIELDLIST
374 class FieldListRecord : public TypeRecord {
375 public:
376  FieldListRecord() = default;
379  : TypeRecord(TypeRecordKind::FieldList), Data(Data) {}
380 
382 };
383 
384 // LF_ARRAY
385 class ArrayRecord : public TypeRecord {
386 public:
387  ArrayRecord() = default;
389  ArrayRecord(TypeIndex ElementType, TypeIndex IndexType, uint64_t Size,
390  StringRef Name)
391  : TypeRecord(TypeRecordKind::Array), ElementType(ElementType),
392  IndexType(IndexType), Size(Size), Name(Name) {}
393 
394  TypeIndex getElementType() const { return ElementType; }
395  TypeIndex getIndexType() const { return IndexType; }
396  uint64_t getSize() const { return Size; }
397  StringRef getName() const { return Name; }
398 
401  uint64_t Size;
403 };
404 
405 class TagRecord : public TypeRecord {
406 protected:
407  TagRecord() = default;
409  TagRecord(TypeRecordKind Kind, uint16_t MemberCount, ClassOptions Options,
411  : TypeRecord(Kind), MemberCount(MemberCount), Options(Options),
412  FieldList(FieldList), Name(Name), UniqueName(UniqueName) {}
413 
414 public:
415  static const int HfaKindShift = 11;
416  static const int HfaKindMask = 0x1800;
417  static const int WinRTKindShift = 14;
418  static const int WinRTKindMask = 0xC000;
419 
420  bool hasUniqueName() const {
421  return (Options & ClassOptions::HasUniqueName) != ClassOptions::None;
422  }
423 
424  bool isNested() const {
425  return (Options & ClassOptions::Nested) != ClassOptions::None;
426  }
427 
428  bool isForwardRef() const {
430  }
431 
432  uint16_t getMemberCount() const { return MemberCount; }
433  ClassOptions getOptions() const { return Options; }
434  TypeIndex getFieldList() const { return FieldList; }
435  StringRef getName() const { return Name; }
436  StringRef getUniqueName() const { return UniqueName; }
437 
438  uint16_t MemberCount;
443 };
444 
445 // LF_CLASS, LF_STRUCTURE, LF_INTERFACE
446 class ClassRecord : public TagRecord {
447 public:
448  ClassRecord() = default;
450  ClassRecord(TypeRecordKind Kind, uint16_t MemberCount, ClassOptions Options,
451  TypeIndex FieldList, TypeIndex DerivationList,
452  TypeIndex VTableShape, uint64_t Size, StringRef Name,
453  StringRef UniqueName)
454  : TagRecord(Kind, MemberCount, Options, FieldList, Name, UniqueName),
455  DerivationList(DerivationList), VTableShape(VTableShape), Size(Size) {}
456 
457  HfaKind getHfa() const {
458  uint16_t Value = static_cast<uint16_t>(Options);
459  Value = (Value & HfaKindMask) >> HfaKindShift;
460  return static_cast<HfaKind>(Value);
461  }
462 
464  uint16_t Value = static_cast<uint16_t>(Options);
465  Value = (Value & WinRTKindMask) >> WinRTKindShift;
466  return static_cast<WindowsRTClassKind>(Value);
467  }
468 
469  TypeIndex getDerivationList() const { return DerivationList; }
470  TypeIndex getVTableShape() const { return VTableShape; }
471  uint64_t getSize() const { return Size; }
472 
475  uint64_t Size;
476 };
477 
478 // LF_UNION
479 struct UnionRecord : public TagRecord {
480  UnionRecord() = default;
482  UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,
483  uint64_t Size, StringRef Name, StringRef UniqueName)
484  : TagRecord(TypeRecordKind::Union, MemberCount, Options, FieldList, Name,
485  UniqueName),
486  Size(Size) {}
487 
488  HfaKind getHfa() const {
489  uint16_t Value = static_cast<uint16_t>(Options);
490  Value = (Value & HfaKindMask) >> HfaKindShift;
491  return static_cast<HfaKind>(Value);
492  }
493 
494  uint64_t getSize() const { return Size; }
495 
496  uint64_t Size;
497 };
498 
499 // LF_ENUM
500 class EnumRecord : public TagRecord {
501 public:
502  EnumRecord() = default;
504  EnumRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,
505  StringRef Name, StringRef UniqueName, TypeIndex UnderlyingType)
506  : TagRecord(TypeRecordKind::Enum, MemberCount, Options, FieldList, Name,
507  UniqueName),
508  UnderlyingType(UnderlyingType) {}
509 
510  TypeIndex getUnderlyingType() const { return UnderlyingType; }
511 
513 };
514 
515 // LF_BITFIELD
516 class BitFieldRecord : public TypeRecord {
517 public:
518  BitFieldRecord() = default;
520  BitFieldRecord(TypeIndex Type, uint8_t BitSize, uint8_t BitOffset)
521  : TypeRecord(TypeRecordKind::BitField), Type(Type), BitSize(BitSize),
522  BitOffset(BitOffset) {}
523 
524  TypeIndex getType() const { return Type; }
525  uint8_t getBitOffset() const { return BitOffset; }
526  uint8_t getBitSize() const { return BitSize; }
527 
529  uint8_t BitSize;
530  uint8_t BitOffset;
531 };
532 
533 // LF_VTSHAPE
535 public:
536  VFTableShapeRecord() = default;
539  : TypeRecord(TypeRecordKind::VFTableShape), SlotsRef(Slots) {}
540  explicit VFTableShapeRecord(std::vector<VFTableSlotKind> Slots)
541  : TypeRecord(TypeRecordKind::VFTableShape), Slots(std::move(Slots)) {}
542 
544  if (!SlotsRef.empty())
545  return SlotsRef;
546  return Slots;
547  }
548 
549  uint32_t getEntryCount() const { return getSlots().size(); }
550 
552  std::vector<VFTableSlotKind> Slots;
553 };
554 
555 // LF_TYPESERVER2
557 public:
558  TypeServer2Record() = default;
561  : TypeRecord(TypeRecordKind::TypeServer2), Age(Age), Name(Name) {
562  assert(GuidStr.size() == 16 && "guid isn't 16 bytes");
563  ::memcpy(Guid.Guid, GuidStr.data(), 16);
564  }
565 
566  const GUID &getGuid() const { return Guid; }
567  uint32_t getAge() const { return Age; }
568  StringRef getName() const { return Name; }
569 
573 };
574 
575 // LF_STRING_ID
576 class StringIdRecord : public TypeRecord {
577 public:
578  StringIdRecord() = default;
581  : TypeRecord(TypeRecordKind::StringId), Id(Id), String(String) {}
582 
583  TypeIndex getId() const { return Id; }
584  StringRef getString() const { return String; }
585 
588 };
589 
590 // LF_FUNC_ID
591 class FuncIdRecord : public TypeRecord {
592 public:
593  FuncIdRecord() = default;
596  : TypeRecord(TypeRecordKind::FuncId), ParentScope(ParentScope),
597  FunctionType(FunctionType), Name(Name) {}
598 
599  TypeIndex getParentScope() const { return ParentScope; }
601  StringRef getName() const { return Name; }
602 
606 };
607 
608 // LF_UDT_SRC_LINE
610 public:
611  UdtSourceLineRecord() = default;
613  UdtSourceLineRecord(TypeIndex UDT, TypeIndex SourceFile, uint32_t LineNumber)
614  : TypeRecord(TypeRecordKind::UdtSourceLine), UDT(UDT),
615  SourceFile(SourceFile), LineNumber(LineNumber) {}
616 
617  TypeIndex getUDT() const { return UDT; }
618  TypeIndex getSourceFile() const { return SourceFile; }
619  uint32_t getLineNumber() const { return LineNumber; }
620 
624 };
625 
626 // LF_UDT_MOD_SRC_LINE
628 public:
629  UdtModSourceLineRecord() = default;
632  uint32_t LineNumber, uint16_t Module)
633  : TypeRecord(TypeRecordKind::UdtSourceLine), UDT(UDT),
634  SourceFile(SourceFile), LineNumber(LineNumber), Module(Module) {}
635 
636  TypeIndex getUDT() const { return UDT; }
637  TypeIndex getSourceFile() const { return SourceFile; }
638  uint32_t getLineNumber() const { return LineNumber; }
639  uint16_t getModule() const { return Module; }
640 
644  uint16_t Module;
645 };
646 
647 // LF_BUILDINFO
648 class BuildInfoRecord : public TypeRecord {
649 public:
650  BuildInfoRecord() = default;
653  : TypeRecord(TypeRecordKind::BuildInfo),
654  ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
655 
656  ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
657 
659 };
660 
661 // LF_VFTABLE
662 class VFTableRecord : public TypeRecord {
663 public:
664  VFTableRecord() = default;
666  VFTableRecord(TypeIndex CompleteClass, TypeIndex OverriddenVFTable,
667  uint32_t VFPtrOffset, StringRef Name,
668  ArrayRef<StringRef> Methods)
669  : TypeRecord(TypeRecordKind::VFTable), CompleteClass(CompleteClass),
670  OverriddenVFTable(OverriddenVFTable), VFPtrOffset(VFPtrOffset) {
671  MethodNames.push_back(Name);
672  MethodNames.insert(MethodNames.end(), Methods.begin(), Methods.end());
673  }
674 
675  TypeIndex getCompleteClass() const { return CompleteClass; }
676  TypeIndex getOverriddenVTable() const { return OverriddenVFTable; }
677  uint32_t getVFPtrOffset() const { return VFPtrOffset; }
678  StringRef getName() const { return makeArrayRef(MethodNames).front(); }
679 
681  return makeArrayRef(MethodNames).drop_front();
682  }
683 
687  std::vector<StringRef> MethodNames;
688 };
689 
690 // LF_ONEMETHOD
691 class OneMethodRecord : public TypeRecord {
692 public:
693  OneMethodRecord() = default;
696  StringRef Name)
697  : TypeRecord(TypeRecordKind::OneMethod), Type(Type), Attrs(Attrs),
698  VFTableOffset(VFTableOffset), Name(Name) {}
700  MethodOptions Options, int32_t VFTableOffset, StringRef Name)
701  : TypeRecord(TypeRecordKind::OneMethod), Type(Type),
702  Attrs(Access, MK, Options), VFTableOffset(VFTableOffset), Name(Name) {}
703 
704  TypeIndex getType() const { return Type; }
705  MethodKind getMethodKind() const { return Attrs.getMethodKind(); }
706  MethodOptions getOptions() const { return Attrs.getFlags(); }
707  MemberAccess getAccess() const { return Attrs.getAccess(); }
708  int32_t getVFTableOffset() const { return VFTableOffset; }
709  StringRef getName() const { return Name; }
710 
711  bool isIntroducingVirtual() const {
714  }
715 
718  int32_t VFTableOffset;
720 };
721 
722 // LF_METHODLIST
724 public:
725  MethodOverloadListRecord() = default;
728  : TypeRecord(TypeRecordKind::MethodOverloadList), Methods(Methods) {}
729 
730  ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
731 
732  std::vector<OneMethodRecord> Methods;
733 };
734 
735 /// For method overload sets. LF_METHOD
737 public:
738  OverloadedMethodRecord() = default;
740  OverloadedMethodRecord(uint16_t NumOverloads, TypeIndex MethodList,
741  StringRef Name)
742  : TypeRecord(TypeRecordKind::OverloadedMethod),
743  NumOverloads(NumOverloads), MethodList(MethodList), Name(Name) {}
744 
745  uint16_t getNumOverloads() const { return NumOverloads; }
746  TypeIndex getMethodList() const { return MethodList; }
747  StringRef getName() const { return Name; }
748 
749  uint16_t NumOverloads;
752 };
753 
754 // LF_MEMBER
755 class DataMemberRecord : public TypeRecord {
756 public:
757  DataMemberRecord() = default;
760  StringRef Name)
761  : TypeRecord(TypeRecordKind::DataMember), Attrs(Attrs), Type(Type),
762  FieldOffset(Offset), Name(Name) {}
764  StringRef Name)
765  : TypeRecord(TypeRecordKind::DataMember), Attrs(Access), Type(Type),
766  FieldOffset(Offset), Name(Name) {}
767 
768  MemberAccess getAccess() const { return Attrs.getAccess(); }
769  TypeIndex getType() const { return Type; }
770  uint64_t getFieldOffset() const { return FieldOffset; }
771  StringRef getName() const { return Name; }
772 
775  uint64_t FieldOffset;
777 };
778 
779 // LF_STMEMBER
781 public:
782  StaticDataMemberRecord() = default;
785  : TypeRecord(TypeRecordKind::StaticDataMember), Attrs(Attrs), Type(Type),
786  Name(Name) {}
788  : TypeRecord(TypeRecordKind::StaticDataMember), Attrs(Access), Type(Type),
789  Name(Name) {}
790 
791  MemberAccess getAccess() const { return Attrs.getAccess(); }
792  TypeIndex getType() const { return Type; }
793  StringRef getName() const { return Name; }
794 
798 };
799 
800 // LF_ENUMERATE
801 class EnumeratorRecord : public TypeRecord {
802 public:
803  EnumeratorRecord() = default;
806  : TypeRecord(TypeRecordKind::Enumerator), Attrs(Attrs),
807  Value(std::move(Value)), Name(Name) {}
810  Value(std::move(Value)), Name(Name) {}
811 
812  MemberAccess getAccess() const { return Attrs.getAccess(); }
813  APSInt getValue() const { return Value; }
814  StringRef getName() const { return Name; }
815 
819 };
820 
821 // LF_VFUNCTAB
822 class VFPtrRecord : public TypeRecord {
823 public:
824  VFPtrRecord() = default;
827  : TypeRecord(TypeRecordKind::VFPtr), Type(Type) {}
828 
829  TypeIndex getType() const { return Type; }
830 
832 };
833 
834 // LF_BCLASS, LF_BINTERFACE
835 class BaseClassRecord : public TypeRecord {
836 public:
837  BaseClassRecord() = default;
840  : TypeRecord(TypeRecordKind::BaseClass), Attrs(Attrs), Type(Type),
841  Offset(Offset) {}
843  : TypeRecord(TypeRecordKind::BaseClass), Attrs(Access), Type(Type),
844  Offset(Offset) {}
845 
846  MemberAccess getAccess() const { return Attrs.getAccess(); }
847  TypeIndex getBaseType() const { return Type; }
848  uint64_t getBaseOffset() const { return Offset; }
849 
852  uint64_t Offset;
853 };
854 
855 // LF_VBCLASS, LF_IVBCLASS
857 public:
858  VirtualBaseClassRecord() = default;
861  TypeIndex BaseType, TypeIndex VBPtrType,
862  uint64_t Offset, uint64_t Index)
863  : TypeRecord(Kind), Attrs(Attrs), BaseType(BaseType),
864  VBPtrType(VBPtrType), VBPtrOffset(Offset), VTableIndex(Index) {}
866  TypeIndex BaseType, TypeIndex VBPtrType,
867  uint64_t Offset, uint64_t Index)
868  : TypeRecord(Kind), Attrs(Access), BaseType(BaseType),
869  VBPtrType(VBPtrType), VBPtrOffset(Offset), VTableIndex(Index) {}
870 
871  MemberAccess getAccess() const { return Attrs.getAccess(); }
872  TypeIndex getBaseType() const { return BaseType; }
873  TypeIndex getVBPtrType() const { return VBPtrType; }
874  uint64_t getVBPtrOffset() const { return VBPtrOffset; }
875  uint64_t getVTableIndex() const { return VTableIndex; }
876 
880  uint64_t VBPtrOffset;
881  uint64_t VTableIndex;
882 };
883 
884 /// LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST records
885 /// together. The first will end in an LF_INDEX record that points to the next.
887 public:
888  ListContinuationRecord() = default;
891  : TypeRecord(TypeRecordKind::ListContinuation),
892  ContinuationIndex(ContinuationIndex) {}
893 
894  TypeIndex getContinuationIndex() const { return ContinuationIndex; }
895 
897 };
898 
899 // LF_PRECOMP
900 class PrecompRecord : public TypeRecord {
901 public:
902  PrecompRecord() = default;
904 
905  uint32_t getStartTypeIndex() const { return StartTypeIndex; }
906  uint32_t getTypesCount() const { return TypesCount; }
907  uint32_t getSignature() const { return Signature; }
908  StringRef getPrecompFilePath() const { return PrecompFilePath; }
909 
914 };
915 
916 // LF_ENDPRECOMP
917 class EndPrecompRecord : public TypeRecord {
918 public:
919  EndPrecompRecord() = default;
921 
922  uint32_t getSignature() const { return Signature; }
923 
925 };
926 } // end namespace codeview
927 } // end namespace llvm
928 
929 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H
MemberAccess getAccess() const
Definition: TypeRecord.h:812
PointerKind
Equivalent to CV_ptrtype_e.
Definition: CodeView.h:326
TypeIndex getIndexType() const
Definition: TypeRecord.h:395
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:250
int32_t getThisPointerAdjustment() const
Definition: TypeRecord.h:194
UdtSourceLineRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:612
MemberAttributes(MemberAccess Access)
Definition: TypeRecord.h:56
VirtualBaseClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:859
uint16_t getMemberCount() const
Definition: TypeRecord.h:432
uint64_t getSize() const
Definition: TypeRecord.h:396
BuildInfoRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:651
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:241
uint32_t getSignature() const
Definition: TypeRecord.h:907
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:471
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:409
MethodOverloadListRecord(ArrayRef< OneMethodRecord > Methods)
Definition: TypeRecord.h:727
iterator begin() const
Definition: ArrayRef.h:137
StaticDataMemberRecord(MemberAttributes Attrs, TypeIndex Type, StringRef Name)
Definition: TypeRecord.h:784
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:860
TypeIndex getBaseType() const
Definition: TypeRecord.h:847
ArrayRef< StringRef > getMethodNames() const
Definition: TypeRecord.h:680
MemberAccess getAccess() const
Definition: TypeRecord.h:707
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:580
BuildInfoRecord(ArrayRef< TypeIndex > ArgIndices)
Definition: TypeRecord.h:652
NestedTypeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:362
OverloadedMethodRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:739
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:450
TypeIndex getType() const
Definition: TypeRecord.h:524
FieldListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:377
FieldListRecord(ArrayRef< uint8_t > Data)
Definition: TypeRecord.h:378
ArrayRef< uint8_t > Data
Definition: TypeRecord.h:381
TypeServer2Record(StringRef GuidStr, uint32_t Age, StringRef Name)
Definition: TypeRecord.h:560
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
Definition: Endian.h:269
TypeServer2Record(TypeRecordKind Kind)
Definition: TypeRecord.h:559
BitFieldRecord(TypeIndex Type, uint8_t BitSize, uint8_t BitOffset)
Definition: TypeRecord.h:520
WindowsRTClassKind getWinRTKind() const
Definition: TypeRecord.h:463
OneMethodRecord(TypeIndex Type, MemberAttributes Attrs, int32_t VFTableOffset, StringRef Name)
Definition: TypeRecord.h:695
BitFieldRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:519
ArgListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:240
MethodKind getMethodKind() const
Definition: TypeRecord.h:705
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:699
TypeIndex getFunctionType() const
Definition: TypeRecord.h:228
EnumRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList, StringRef Name, StringRef UniqueName, TypeIndex UnderlyingType)
Definition: TypeRecord.h:504
MemberFunctionRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:175
bool isForwardRef() const
Definition: TypeRecord.h:428
PointerRecord(TypeIndex ReferentType, PointerKind PK, PointerMode PM, PointerOptions PO, uint8_t Size)
Definition: TypeRecord.h:285
StringRef getName() const
Definition: TypeRecord.h:435
bool hasUniqueName() const
Definition: TypeRecord.h:420
DataMemberRecord(MemberAttributes Attrs, TypeIndex Type, uint64_t Offset, StringRef Name)
Definition: TypeRecord.h:759
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:601
StringRef getName() const
Definition: TypeRecord.h:397
ArrayRef< VFTableSlotKind > SlotsRef
Definition: TypeRecord.h:551
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:848
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:865
OneMethodRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:694
ClassOptions getOptions() const
Definition: TypeRecord.h:433
ModifierOptions
Equivalent to CV_modifier_t.
Definition: CodeView.h:297
static MethodKind getMethodKind(uint16_t Attrs)
TypeIndex getFunctionType() const
Definition: TypeRecord.h:600
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:613
TypeIndex getElementType() const
Definition: TypeRecord.h:394
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:666
MemberAccess getAccess() const
Definition: TypeRecord.h:768
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:804
TypeIndex getFieldList() const
Definition: TypeRecord.h:434
StringRef getString() const
Definition: TypeRecord.h:584
ArrayRef< TypeIndex > getArgs() const
Definition: TypeRecord.h:656
VFTableRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:665
TypeRecordKind
Distinguishes individual records in .debug$T or .debug$P section or PDB type stream.
Definition: CodeView.h:27
PointerToMemberRepresentation getRepresentation() const
Definition: TypeRecord.h:111
ListContinuationRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:889
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:677
bool isIntroducedVirtual() const
Does this member introduce a new virtual method.
Definition: TypeRecord.h:93
Optional< MemberPointerInfo > MemberInfo
Definition: TypeRecord.h:339
NestedTypeRecord(TypeIndex Type, StringRef Name)
Definition: TypeRecord.h:363
LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST records together.
Definition: TypeRecord.h:886
StringRef getUniqueName() const
Definition: TypeRecord.h:436
TypeIndex getContainingType() const
Definition: TypeRecord.h:110
std::vector< TypeIndex > ArgIndices
Definition: TypeRecord.h:247
FuncIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:594
StringListRecord(TypeRecordKind Kind, ArrayRef< TypeIndex > Indices)
Definition: TypeRecord.h:256
TagRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:408
For method overload sets. LF_METHOD.
Definition: TypeRecord.h:736
OverloadedMethodRecord(uint16_t NumOverloads, TypeIndex MethodList, StringRef Name)
Definition: TypeRecord.h:740
TypeIndex getArgumentList() const
Definition: TypeRecord.h:162
FuncIdRecord(TypeIndex ParentScope, TypeIndex FunctionType, StringRef Name)
Definition: TypeRecord.h:595
MethodOptions getOptions() const
Definition: TypeRecord.h:706
PointerKind getPointerKind() const
Definition: TypeRecord.h:297
std::vector< StringRef > MethodNames
Definition: TypeRecord.h:687
ArrayRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:388
TypeIndex getUnderlyingType() const
Definition: TypeRecord.h:510
UdtModSourceLineRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:630
uint32_t getTypesCount() const
Definition: TypeRecord.h:906
BaseClassRecord(MemberAttributes Attrs, TypeIndex Type, uint64_t Offset)
Definition: TypeRecord.h:839
ListContinuationRecord(TypeIndex ContinuationIndex)
Definition: TypeRecord.h:890
StringListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:254
uint64_t getSize() const
Definition: TypeRecord.h:494
ProcedureRecord(TypeIndex ReturnType, CallingConvention CallConv, FunctionOptions Options, uint16_t ParameterCount, TypeIndex ArgumentList)
Definition: TypeRecord.h:151
PrecompRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:903
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:726
EndPrecompRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:920
int32_t getVFTableOffset() const
Definition: TypeRecord.h:708
UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList, uint64_t Size, StringRef Name, StringRef UniqueName)
Definition: TypeRecord.h:482
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:787
TypeIndex getVTableShape() const
Definition: TypeRecord.h:470
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:846
DataMemberRecord(MemberAccess Access, TypeIndex Type, uint64_t Offset, StringRef Name)
Definition: TypeRecord.h:763
HfaKind getHfa() const
Definition: TypeRecord.h:488
EnumeratorRecord(MemberAccess Access, APSInt Value, StringRef Name)
Definition: TypeRecord.h:808
TypeIndex getOverriddenVTable() const
Definition: TypeRecord.h:676
TypeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:122
ArrayRef< OneMethodRecord > getMethods() const
Definition: TypeRecord.h:730
PointerMode
Equivalent to CV_ptrmode_e.
Definition: CodeView.h:343
VFTableShapeRecord(ArrayRef< VFTableSlotKind > Slots)
Definition: TypeRecord.h:538
A range adaptor for a pair of iterators.
ArrayRef< TypeIndex > getIndices() const
Definition: TypeRecord.h:259
uint8_t getBitOffset() const
Definition: TypeRecord.h:525
TypeIndex getDerivationList() const
Definition: TypeRecord.h:469
TypeIndex getParentScope() const
Definition: TypeRecord.h:599
MemberFuncIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:221
ClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:449
TypeIndex getCompleteClass() const
Definition: TypeRecord.h:675
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:341
std::vector< OneMethodRecord > Methods
Definition: TypeRecord.h:732
TypeIndex getNestedType() const
Definition: TypeRecord.h:366
MemberFuncIdRecord(TypeIndex ClassType, TypeIndex FunctionType, StringRef Name)
Definition: TypeRecord.h:222
const GUID & getGuid() const
Definition: TypeRecord.h:566
VFTableShapeRecord(std::vector< VFTableSlotKind > Slots)
Definition: TypeRecord.h:540
StringRef getPrecompFilePath() const
Definition: TypeRecord.h:908
CallingConvention getCallConv() const
Definition: TypeRecord.h:159
SmallVector< TypeIndex, 4 > ArgIndices
Definition: TypeRecord.h:658
detail::packed_endian_specific_integral< int32_t, little, unaligned > little32_t
Definition: Endian.h:278
VFTableShapeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:537
ArrayRef< TypeIndex > getIndices() const
Definition: TypeRecord.h:245
StaticDataMemberRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:783
PointerOptions getOptions() const
Definition: TypeRecord.h:307
ArrayRecord(TypeIndex ElementType, TypeIndex IndexType, uint64_t Size, StringRef Name)
Definition: TypeRecord.h:389
TypeIndex getType() const
Definition: TypeRecord.h:829
FunctionOptions getOptions() const
Definition: TypeRecord.h:160
EnumeratorRecord(MemberAttributes Attrs, APSInt Value, StringRef Name)
Definition: TypeRecord.h:805
PointerToMemberRepresentation
Equivalent to CV_pmtype_e.
Definition: CodeView.h:364
VFPtrRecord(TypeIndex Type)
Definition: TypeRecord.h:826
ProcedureRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:150
StringIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:579
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:758
uint64_t getFieldOffset() const
Definition: TypeRecord.h:770
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:552
BaseClassRecord(MemberAccess Access, TypeIndex Type, uint64_t Offset)
Definition: TypeRecord.h:842
ArrayRef< VFTableSlotKind > getSlots() const
Definition: TypeRecord.h:543
BaseClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:838
Equvalent to CV_fldattr_t in cvinfo.h.
Definition: TypeRecord.h:47
UnionRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:481
LLVM Value Representation.
Definition: Value.h:73
EnumRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:503
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
uint32_t getStartTypeIndex() const
Definition: TypeRecord.h:905
VFPtrRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:825
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:457
UdtModSourceLineRecord(TypeIndex UDT, TypeIndex SourceFile, uint32_t LineNumber, uint16_t Module)
Definition: TypeRecord.h:631
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:678
ModifierOptions getModifiers() const
Definition: TypeRecord.h:140