LLVM  6.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 
337 private:
338  static uint32_t calcAttrs(PointerKind PK, PointerMode PM, PointerOptions PO,
339  uint8_t Size) {
340  uint32_t A = 0;
341  A |= static_cast<uint32_t>(PK);
342  A |= static_cast<uint32_t>(PO);
343  A |= (static_cast<uint32_t>(PM) << PointerModeShift);
344  A |= (static_cast<uint32_t>(Size) << PointerSizeShift);
345  return A;
346  }
347 };
348 
349 // LF_NESTTYPE
350 class NestedTypeRecord : public TypeRecord {
351 public:
352  NestedTypeRecord() = default;
355  : TypeRecord(TypeRecordKind::NestedType), Type(Type), Name(Name) {}
356 
357  TypeIndex getNestedType() const { return Type; }
358  StringRef getName() const { return Name; }
359 
362 };
363 
364 // LF_FIELDLIST
365 class FieldListRecord : public TypeRecord {
366 public:
367  FieldListRecord() = default;
370  : TypeRecord(TypeRecordKind::FieldList), Data(Data) {}
371 
373 };
374 
375 // LF_ARRAY
376 class ArrayRecord : public TypeRecord {
377 public:
378  ArrayRecord() = default;
380  ArrayRecord(TypeIndex ElementType, TypeIndex IndexType, uint64_t Size,
381  StringRef Name)
382  : TypeRecord(TypeRecordKind::Array), ElementType(ElementType),
383  IndexType(IndexType), Size(Size), Name(Name) {}
384 
385  TypeIndex getElementType() const { return ElementType; }
386  TypeIndex getIndexType() const { return IndexType; }
387  uint64_t getSize() const { return Size; }
388  StringRef getName() const { return Name; }
389 
392  uint64_t Size;
394 };
395 
396 class TagRecord : public TypeRecord {
397 protected:
398  TagRecord() = default;
400  TagRecord(TypeRecordKind Kind, uint16_t MemberCount, ClassOptions Options,
401  TypeIndex FieldList, StringRef Name, StringRef UniqueName)
402  : TypeRecord(Kind), MemberCount(MemberCount), Options(Options),
403  FieldList(FieldList), Name(Name), UniqueName(UniqueName) {}
404 
405 public:
406  static const int HfaKindShift = 11;
407  static const int HfaKindMask = 0x1800;
408  static const int WinRTKindShift = 14;
409  static const int WinRTKindMask = 0xC000;
410 
411  bool hasUniqueName() const {
412  return (Options & ClassOptions::HasUniqueName) != ClassOptions::None;
413  }
414 
415  bool isNested() const {
416  return (Options & ClassOptions::Nested) != ClassOptions::None;
417  }
418 
419  bool isForwardRef() const {
421  }
422 
423  uint16_t getMemberCount() const { return MemberCount; }
424  ClassOptions getOptions() const { return Options; }
425  TypeIndex getFieldList() const { return FieldList; }
426  StringRef getName() const { return Name; }
427  StringRef getUniqueName() const { return UniqueName; }
428 
429  uint16_t MemberCount;
434 };
435 
436 // LF_CLASS, LF_STRUCTURE, LF_INTERFACE
437 class ClassRecord : public TagRecord {
438 public:
439  ClassRecord() = default;
441  ClassRecord(TypeRecordKind Kind, uint16_t MemberCount, ClassOptions Options,
442  TypeIndex FieldList, TypeIndex DerivationList,
443  TypeIndex VTableShape, uint64_t Size, StringRef Name,
444  StringRef UniqueName)
445  : TagRecord(Kind, MemberCount, Options, FieldList, Name, UniqueName),
446  DerivationList(DerivationList), VTableShape(VTableShape), Size(Size) {}
447 
448  HfaKind getHfa() const {
449  uint16_t Value = static_cast<uint16_t>(Options);
450  Value = (Value & HfaKindMask) >> HfaKindShift;
451  return static_cast<HfaKind>(Value);
452  }
453 
455  uint16_t Value = static_cast<uint16_t>(Options);
456  Value = (Value & WinRTKindMask) >> WinRTKindShift;
457  return static_cast<WindowsRTClassKind>(Value);
458  }
459 
460  TypeIndex getDerivationList() const { return DerivationList; }
461  TypeIndex getVTableShape() const { return VTableShape; }
462  uint64_t getSize() const { return Size; }
463 
466  uint64_t Size;
467 };
468 
469 // LF_UNION
470 struct UnionRecord : public TagRecord {
471  UnionRecord() = default;
473  UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,
474  uint64_t Size, StringRef Name, StringRef UniqueName)
475  : TagRecord(TypeRecordKind::Union, MemberCount, Options, FieldList, Name,
476  UniqueName),
477  Size(Size) {}
478 
479  HfaKind getHfa() const {
480  uint16_t Value = static_cast<uint16_t>(Options);
481  Value = (Value & HfaKindMask) >> HfaKindShift;
482  return static_cast<HfaKind>(Value);
483  }
484 
485  uint64_t getSize() const { return Size; }
486 
487  uint64_t Size;
488 };
489 
490 // LF_ENUM
491 class EnumRecord : public TagRecord {
492 public:
493  EnumRecord() = default;
495  EnumRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,
496  StringRef Name, StringRef UniqueName, TypeIndex UnderlyingType)
497  : TagRecord(TypeRecordKind::Enum, MemberCount, Options, FieldList, Name,
498  UniqueName),
499  UnderlyingType(UnderlyingType) {}
500 
501  TypeIndex getUnderlyingType() const { return UnderlyingType; }
502 
504 };
505 
506 // LF_BITFIELD
507 class BitFieldRecord : public TypeRecord {
508 public:
509  BitFieldRecord() = default;
511  BitFieldRecord(TypeIndex Type, uint8_t BitSize, uint8_t BitOffset)
512  : TypeRecord(TypeRecordKind::BitField), Type(Type), BitSize(BitSize),
513  BitOffset(BitOffset) {}
514 
515  TypeIndex getType() const { return Type; }
516  uint8_t getBitOffset() const { return BitOffset; }
517  uint8_t getBitSize() const { return BitSize; }
518 
520  uint8_t BitSize;
521  uint8_t BitOffset;
522 };
523 
524 // LF_VTSHAPE
526 public:
527  VFTableShapeRecord() = default;
530  : TypeRecord(TypeRecordKind::VFTableShape), SlotsRef(Slots) {}
531  explicit VFTableShapeRecord(std::vector<VFTableSlotKind> Slots)
532  : TypeRecord(TypeRecordKind::VFTableShape), Slots(std::move(Slots)) {}
533 
535  if (!SlotsRef.empty())
536  return SlotsRef;
537  return Slots;
538  }
539 
540  uint32_t getEntryCount() const { return getSlots().size(); }
541 
543  std::vector<VFTableSlotKind> Slots;
544 };
545 
546 // LF_TYPESERVER2
548 public:
549  TypeServer2Record() = default;
552  : TypeRecord(TypeRecordKind::TypeServer2), Age(Age), Name(Name) {
553  assert(GuidStr.size() == 16 && "guid isn't 16 bytes");
554  ::memcpy(Guid.Guid, GuidStr.data(), 16);
555  }
556 
557  const GUID &getGuid() const { return Guid; }
558  uint32_t getAge() const { return Age; }
559  StringRef getName() const { return Name; }
560 
564 };
565 
566 // LF_STRING_ID
567 class StringIdRecord : public TypeRecord {
568 public:
569  StringIdRecord() = default;
572  : TypeRecord(TypeRecordKind::StringId), Id(Id), String(String) {}
573 
574  TypeIndex getId() const { return Id; }
575  StringRef getString() const { return String; }
576 
579 };
580 
581 // LF_FUNC_ID
582 class FuncIdRecord : public TypeRecord {
583 public:
584  FuncIdRecord() = default;
587  : TypeRecord(TypeRecordKind::FuncId), ParentScope(ParentScope),
588  FunctionType(FunctionType), Name(Name) {}
589 
590  TypeIndex getParentScope() const { return ParentScope; }
592  StringRef getName() const { return Name; }
593 
597 };
598 
599 // LF_UDT_SRC_LINE
601 public:
602  UdtSourceLineRecord() = default;
604  UdtSourceLineRecord(TypeIndex UDT, TypeIndex SourceFile, uint32_t LineNumber)
605  : TypeRecord(TypeRecordKind::UdtSourceLine), UDT(UDT),
606  SourceFile(SourceFile), LineNumber(LineNumber) {}
607 
608  TypeIndex getUDT() const { return UDT; }
609  TypeIndex getSourceFile() const { return SourceFile; }
610  uint32_t getLineNumber() const { return LineNumber; }
611 
615 };
616 
617 // LF_UDT_MOD_SRC_LINE
619 public:
620  UdtModSourceLineRecord() = default;
623  uint32_t LineNumber, uint16_t Module)
624  : TypeRecord(TypeRecordKind::UdtSourceLine), UDT(UDT),
625  SourceFile(SourceFile), LineNumber(LineNumber), Module(Module) {}
626 
627  TypeIndex getUDT() const { return UDT; }
628  TypeIndex getSourceFile() const { return SourceFile; }
629  uint32_t getLineNumber() const { return LineNumber; }
630  uint16_t getModule() const { return Module; }
631 
635  uint16_t Module;
636 };
637 
638 // LF_BUILDINFO
639 class BuildInfoRecord : public TypeRecord {
640 public:
641  BuildInfoRecord() = default;
644  : TypeRecord(TypeRecordKind::BuildInfo),
645  ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
646 
647  ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
648 
650 };
651 
652 // LF_VFTABLE
653 class VFTableRecord : public TypeRecord {
654 public:
655  VFTableRecord() = default;
657  VFTableRecord(TypeIndex CompleteClass, TypeIndex OverriddenVFTable,
658  uint32_t VFPtrOffset, StringRef Name,
659  ArrayRef<StringRef> Methods)
660  : TypeRecord(TypeRecordKind::VFTable), CompleteClass(CompleteClass),
661  OverriddenVFTable(OverriddenVFTable), VFPtrOffset(VFPtrOffset) {
662  MethodNames.push_back(Name);
663  MethodNames.insert(MethodNames.end(), Methods.begin(), Methods.end());
664  }
665 
666  TypeIndex getCompleteClass() const { return CompleteClass; }
667  TypeIndex getOverriddenVTable() const { return OverriddenVFTable; }
668  uint32_t getVFPtrOffset() const { return VFPtrOffset; }
669  StringRef getName() const { return makeArrayRef(MethodNames).front(); }
670 
672  return makeArrayRef(MethodNames).drop_front();
673  }
674 
678  std::vector<StringRef> MethodNames;
679 };
680 
681 // LF_ONEMETHOD
682 class OneMethodRecord : public TypeRecord {
683 public:
684  OneMethodRecord() = default;
687  StringRef Name)
688  : TypeRecord(TypeRecordKind::OneMethod), Type(Type), Attrs(Attrs),
689  VFTableOffset(VFTableOffset), Name(Name) {}
691  MethodOptions Options, int32_t VFTableOffset, StringRef Name)
692  : TypeRecord(TypeRecordKind::OneMethod), Type(Type),
693  Attrs(Access, MK, Options), VFTableOffset(VFTableOffset), Name(Name) {}
694 
695  TypeIndex getType() const { return Type; }
696  MethodKind getMethodKind() const { return Attrs.getMethodKind(); }
697  MethodOptions getOptions() const { return Attrs.getFlags(); }
698  MemberAccess getAccess() const { return Attrs.getAccess(); }
699  int32_t getVFTableOffset() const { return VFTableOffset; }
700  StringRef getName() const { return Name; }
701 
702  bool isIntroducingVirtual() const {
705  }
706 
709  int32_t VFTableOffset;
711 };
712 
713 // LF_METHODLIST
715 public:
716  MethodOverloadListRecord() = default;
719  : TypeRecord(TypeRecordKind::MethodOverloadList), Methods(Methods) {}
720 
721  ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
722 
723  std::vector<OneMethodRecord> Methods;
724 };
725 
726 /// For method overload sets. LF_METHOD
728 public:
729  OverloadedMethodRecord() = default;
731  OverloadedMethodRecord(uint16_t NumOverloads, TypeIndex MethodList,
732  StringRef Name)
733  : TypeRecord(TypeRecordKind::OverloadedMethod),
734  NumOverloads(NumOverloads), MethodList(MethodList), Name(Name) {}
735 
736  uint16_t getNumOverloads() const { return NumOverloads; }
737  TypeIndex getMethodList() const { return MethodList; }
738  StringRef getName() const { return Name; }
739 
740  uint16_t NumOverloads;
743 };
744 
745 // LF_MEMBER
746 class DataMemberRecord : public TypeRecord {
747 public:
748  DataMemberRecord() = default;
751  StringRef Name)
752  : TypeRecord(TypeRecordKind::DataMember), Attrs(Attrs), Type(Type),
753  FieldOffset(Offset), Name(Name) {}
755  StringRef Name)
756  : TypeRecord(TypeRecordKind::DataMember), Attrs(Access), Type(Type),
757  FieldOffset(Offset), Name(Name) {}
758 
759  MemberAccess getAccess() const { return Attrs.getAccess(); }
760  TypeIndex getType() const { return Type; }
761  uint64_t getFieldOffset() const { return FieldOffset; }
762  StringRef getName() const { return Name; }
763 
766  uint64_t FieldOffset;
768 };
769 
770 // LF_STMEMBER
772 public:
773  StaticDataMemberRecord() = default;
776  : TypeRecord(TypeRecordKind::StaticDataMember), Attrs(Attrs), Type(Type),
777  Name(Name) {}
779  : TypeRecord(TypeRecordKind::StaticDataMember), Attrs(Access), Type(Type),
780  Name(Name) {}
781 
782  MemberAccess getAccess() const { return Attrs.getAccess(); }
783  TypeIndex getType() const { return Type; }
784  StringRef getName() const { return Name; }
785 
789 };
790 
791 // LF_ENUMERATE
792 class EnumeratorRecord : public TypeRecord {
793 public:
794  EnumeratorRecord() = default;
797  : TypeRecord(TypeRecordKind::Enumerator), Attrs(Attrs),
798  Value(std::move(Value)), Name(Name) {}
801  Value(std::move(Value)), Name(Name) {}
802 
803  MemberAccess getAccess() const { return Attrs.getAccess(); }
804  APSInt getValue() const { return Value; }
805  StringRef getName() const { return Name; }
806 
810 };
811 
812 // LF_VFUNCTAB
813 class VFPtrRecord : public TypeRecord {
814 public:
815  VFPtrRecord() = default;
818  : TypeRecord(TypeRecordKind::VFPtr), Type(Type) {}
819 
820  TypeIndex getType() const { return Type; }
821 
823 };
824 
825 // LF_BCLASS, LF_BINTERFACE
826 class BaseClassRecord : public TypeRecord {
827 public:
828  BaseClassRecord() = default;
831  : TypeRecord(TypeRecordKind::BaseClass), Attrs(Attrs), Type(Type),
832  Offset(Offset) {}
834  : TypeRecord(TypeRecordKind::BaseClass), Attrs(Access), Type(Type),
835  Offset(Offset) {}
836 
837  MemberAccess getAccess() const { return Attrs.getAccess(); }
838  TypeIndex getBaseType() const { return Type; }
839  uint64_t getBaseOffset() const { return Offset; }
840 
843  uint64_t Offset;
844 };
845 
846 // LF_VBCLASS, LF_IVBCLASS
848 public:
849  VirtualBaseClassRecord() = default;
852  TypeIndex BaseType, TypeIndex VBPtrType,
853  uint64_t Offset, uint64_t Index)
854  : TypeRecord(Kind), Attrs(Attrs), BaseType(BaseType),
855  VBPtrType(VBPtrType), VBPtrOffset(Offset), VTableIndex(Index) {}
857  TypeIndex BaseType, TypeIndex VBPtrType,
858  uint64_t Offset, uint64_t Index)
859  : TypeRecord(Kind), Attrs(Access), BaseType(BaseType),
860  VBPtrType(VBPtrType), VBPtrOffset(Offset), VTableIndex(Index) {}
861 
862  MemberAccess getAccess() const { return Attrs.getAccess(); }
863  TypeIndex getBaseType() const { return BaseType; }
864  TypeIndex getVBPtrType() const { return VBPtrType; }
865  uint64_t getVBPtrOffset() const { return VBPtrOffset; }
866  uint64_t getVTableIndex() const { return VTableIndex; }
867 
871  uint64_t VBPtrOffset;
872  uint64_t VTableIndex;
873 };
874 
875 /// LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST records
876 /// together. The first will end in an LF_INDEX record that points to the next.
878 public:
879  ListContinuationRecord() = default;
882  : TypeRecord(TypeRecordKind::ListContinuation),
883  ContinuationIndex(ContinuationIndex) {}
884 
885  TypeIndex getContinuationIndex() const { return ContinuationIndex; }
886 
888 };
889 
890 } // end namespace codeview
891 } // end namespace llvm
892 
893 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H
MemberAccess getAccess() const
Definition: TypeRecord.h:803
PointerKind
Equivalent to CV_ptrtype_e.
Definition: CodeView.h:326
TypeIndex getIndexType() const
Definition: TypeRecord.h:386
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:244
int32_t getThisPointerAdjustment() const
Definition: TypeRecord.h:194
UdtSourceLineRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:603
MemberAttributes(MemberAccess Access)
Definition: TypeRecord.h:56
VirtualBaseClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:850
uint16_t getMemberCount() const
Definition: TypeRecord.h:423
uint64_t getSize() const
Definition: TypeRecord.h:387
BuildInfoRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:642
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:235
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:462
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:400
MethodOverloadListRecord(ArrayRef< OneMethodRecord > Methods)
Definition: TypeRecord.h:718
iterator begin() const
Definition: ArrayRef.h:137
StaticDataMemberRecord(MemberAttributes Attrs, TypeIndex Type, StringRef Name)
Definition: TypeRecord.h:775
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:851
TypeIndex getBaseType() const
Definition: TypeRecord.h:838
ArrayRef< StringRef > getMethodNames() const
Definition: TypeRecord.h:671
MemberAccess getAccess() const
Definition: TypeRecord.h:698
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:571
BuildInfoRecord(ArrayRef< TypeIndex > ArgIndices)
Definition: TypeRecord.h:643
NestedTypeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:353
OverloadedMethodRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:730
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:441
TypeIndex getType() const
Definition: TypeRecord.h:515
FieldListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:368
FieldListRecord(ArrayRef< uint8_t > Data)
Definition: TypeRecord.h:369
ArrayRef< uint8_t > Data
Definition: TypeRecord.h:372
TypeServer2Record(StringRef GuidStr, uint32_t Age, StringRef Name)
Definition: TypeRecord.h:551
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
Definition: Endian.h:269
TypeServer2Record(TypeRecordKind Kind)
Definition: TypeRecord.h:550
BitFieldRecord(TypeIndex Type, uint8_t BitSize, uint8_t BitOffset)
Definition: TypeRecord.h:511
WindowsRTClassKind getWinRTKind() const
Definition: TypeRecord.h:454
OneMethodRecord(TypeIndex Type, MemberAttributes Attrs, int32_t VFTableOffset, StringRef Name)
Definition: TypeRecord.h:686
BitFieldRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:510
ArgListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:240
MethodKind getMethodKind() const
Definition: TypeRecord.h:696
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:690
TypeIndex getFunctionType() const
Definition: TypeRecord.h:228
EnumRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList, StringRef Name, StringRef UniqueName, TypeIndex UnderlyingType)
Definition: TypeRecord.h:495
MemberFunctionRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:175
bool isForwardRef() const
Definition: TypeRecord.h:419
PointerRecord(TypeIndex ReferentType, PointerKind PK, PointerMode PM, PointerOptions PO, uint8_t Size)
Definition: TypeRecord.h:285
StringRef getName() const
Definition: TypeRecord.h:426
bool hasUniqueName() const
Definition: TypeRecord.h:411
DataMemberRecord(MemberAttributes Attrs, TypeIndex Type, uint64_t Offset, StringRef Name)
Definition: TypeRecord.h:750
ArgListRecord(TypeRecordKind Kind, ArrayRef< TypeIndex > Indices)
Definition: TypeRecord.h:242
Definition: BitVector.h:920
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:451
StringRef getName() const
Definition: TypeRecord.h:592
StringRef getName() const
Definition: TypeRecord.h:388
ArrayRef< VFTableSlotKind > SlotsRef
Definition: TypeRecord.h:542
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:839
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:856
OneMethodRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:685
ClassOptions getOptions() const
Definition: TypeRecord.h:424
ModifierOptions
Equivalent to CV_modifier_t.
Definition: CodeView.h:297
static MethodKind getMethodKind(uint16_t Attrs)
TypeIndex getFunctionType() const
Definition: TypeRecord.h:591
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:604
TypeIndex getElementType() const
Definition: TypeRecord.h:385
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:657
MemberAccess getAccess() const
Definition: TypeRecord.h:759
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:795
TypeIndex getFieldList() const
Definition: TypeRecord.h:425
StringRef getString() const
Definition: TypeRecord.h:575
ArrayRef< TypeIndex > getArgs() const
Definition: TypeRecord.h:647
VFTableRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:656
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:880
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:668
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:354
LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST records together.
Definition: TypeRecord.h:877
StringRef getUniqueName() const
Definition: TypeRecord.h:427
TypeIndex getContainingType() const
Definition: TypeRecord.h:110
std::vector< TypeIndex > ArgIndices
Definition: TypeRecord.h:247
FuncIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:585
StringListRecord(TypeRecordKind Kind, ArrayRef< TypeIndex > Indices)
Definition: TypeRecord.h:256
TagRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:399
For method overload sets. LF_METHOD.
Definition: TypeRecord.h:727
OverloadedMethodRecord(uint16_t NumOverloads, TypeIndex MethodList, StringRef Name)
Definition: TypeRecord.h:731
TypeIndex getArgumentList() const
Definition: TypeRecord.h:162
FuncIdRecord(TypeIndex ParentScope, TypeIndex FunctionType, StringRef Name)
Definition: TypeRecord.h:586
MethodOptions getOptions() const
Definition: TypeRecord.h:697
PointerKind getPointerKind() const
Definition: TypeRecord.h:297
std::vector< StringRef > MethodNames
Definition: TypeRecord.h:678
ArrayRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:379
TypeIndex getUnderlyingType() const
Definition: TypeRecord.h:501
UdtModSourceLineRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:621
BaseClassRecord(MemberAttributes Attrs, TypeIndex Type, uint64_t Offset)
Definition: TypeRecord.h:830
ListContinuationRecord(TypeIndex ContinuationIndex)
Definition: TypeRecord.h:881
StringListRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:254
uint64_t getSize() const
Definition: TypeRecord.h:485
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:717
int32_t getVFTableOffset() const
Definition: TypeRecord.h:699
UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList, uint64_t Size, StringRef Name, StringRef UniqueName)
Definition: TypeRecord.h:473
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:864
StaticDataMemberRecord(MemberAccess Access, TypeIndex Type, StringRef Name)
Definition: TypeRecord.h:778
TypeIndex getVTableShape() const
Definition: TypeRecord.h:461
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:837
DataMemberRecord(MemberAccess Access, TypeIndex Type, uint64_t Offset, StringRef Name)
Definition: TypeRecord.h:754
HfaKind getHfa() const
Definition: TypeRecord.h:479
EnumeratorRecord(MemberAccess Access, APSInt Value, StringRef Name)
Definition: TypeRecord.h:799
TypeIndex getOverriddenVTable() const
Definition: TypeRecord.h:667
TypeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:122
ArrayRef< OneMethodRecord > getMethods() const
Definition: TypeRecord.h:721
PointerMode
Equivalent to CV_ptrmode_e.
Definition: CodeView.h:343
VFTableShapeRecord(ArrayRef< VFTableSlotKind > Slots)
Definition: TypeRecord.h:529
A range adaptor for a pair of iterators.
ArrayRef< TypeIndex > getIndices() const
Definition: TypeRecord.h:259
uint8_t getBitOffset() const
Definition: TypeRecord.h:516
TypeIndex getDerivationList() const
Definition: TypeRecord.h:460
TypeIndex getParentScope() const
Definition: TypeRecord.h:590
MemberFuncIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:221
ClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:440
TypeIndex getCompleteClass() const
Definition: TypeRecord.h:666
MethodOptions
Equivalent to CV_fldattr_t bitfield.
Definition: CodeView.h:277
bool isVirtual() const
Is this method virtual.
Definition: TypeRecord.h:86
std::vector< OneMethodRecord > Methods
Definition: TypeRecord.h:723
TypeIndex getNestedType() const
Definition: TypeRecord.h:357
MemberFuncIdRecord(TypeIndex ClassType, TypeIndex FunctionType, StringRef Name)
Definition: TypeRecord.h:222
const GUID & getGuid() const
Definition: TypeRecord.h:557
VFTableShapeRecord(std::vector< VFTableSlotKind > Slots)
Definition: TypeRecord.h:531
CallingConvention getCallConv() const
Definition: TypeRecord.h:159
SmallVector< TypeIndex, 4 > ArgIndices
Definition: TypeRecord.h:649
detail::packed_endian_specific_integral< int32_t, little, unaligned > little32_t
Definition: Endian.h:278
VFTableShapeRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:528
ArrayRef< TypeIndex > getIndices() const
Definition: TypeRecord.h:245
StaticDataMemberRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:774
PointerOptions getOptions() const
Definition: TypeRecord.h:307
ArrayRecord(TypeIndex ElementType, TypeIndex IndexType, uint64_t Size, StringRef Name)
Definition: TypeRecord.h:380
TypeIndex getType() const
Definition: TypeRecord.h:820
FunctionOptions getOptions() const
Definition: TypeRecord.h:160
EnumeratorRecord(MemberAttributes Attrs, APSInt Value, StringRef Name)
Definition: TypeRecord.h:796
PointerToMemberRepresentation
Equivalent to CV_pmtype_e.
Definition: CodeView.h:364
VFPtrRecord(TypeIndex Type)
Definition: TypeRecord.h:817
ProcedureRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:150
StringIdRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:570
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:749
uint64_t getFieldOffset() const
Definition: TypeRecord.h:761
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:543
BaseClassRecord(MemberAccess Access, TypeIndex Type, uint64_t Offset)
Definition: TypeRecord.h:833
ArrayRef< VFTableSlotKind > getSlots() const
Definition: TypeRecord.h:534
BaseClassRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:829
Equvalent to CV_fldattr_t in cvinfo.h.
Definition: TypeRecord.h:47
UnionRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:472
LLVM Value Representation.
Definition: Value.h:73
EnumRecord(TypeRecordKind Kind)
Definition: TypeRecord.h:494
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:816
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:448
UdtModSourceLineRecord(TypeIndex UDT, TypeIndex SourceFile, uint32_t LineNumber, uint16_t Module)
Definition: TypeRecord.h:622
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:669
ModifierOptions getModifiers() const
Definition: TypeRecord.h:140