LLVM: lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

10

21

22#include

23#include

24

25using namespace llvm;

28

29namespace {

30

31

32

33

34

35

36

37

38

40public:

41 NativeEnumEnumEnumerators(NativeSession &Session,

42 const NativeTypeEnum &ClassParent);

43

44 uint32_t getChildCount() const override;

45 std::unique_ptr getChildAtIndex(uint32_t Index) const override;

46 std::unique_ptr getNext() override;

47 void reset() override;

48

49private:

51 EnumeratorRecord &Record) override;

53 ListContinuationRecord &Record) override;

54

55 NativeSession &Session;

56 const NativeTypeEnum &ClassParent;

57 std::vector Enumerators;

58 std::optional ContinuationIndex;

59 uint32_t Index = 0;

60};

61}

62

63NativeEnumEnumEnumerators::NativeEnumEnumEnumerators(

68

69 ContinuationIndex = ClassParent.getEnumRecord().FieldList;

70 while (ContinuationIndex) {

71 CVType FieldListCVT = Types.getType(*ContinuationIndex);

72 assert(FieldListCVT.kind() == LF_FIELDLIST);

73 ContinuationIndex.reset();

78 }

79}

80

83 Enumerators.push_back(Record);

85}

86

87Error NativeEnumEnumEnumerators::visitKnownMember(

88 CVMemberRecord &CVM, ListContinuationRecord &Record) {

91}

92

93uint32_t NativeEnumEnumEnumerators::getChildCount() const {

94 return Enumerators.size();

95}

96

97std::unique_ptr

98NativeEnumEnumEnumerators::getChildAtIndex(uint32_t Index) const {

99 if (Index >= getChildCount())

100 return nullptr;

101

107}

108

109std::unique_ptr NativeEnumEnumEnumerators::getNext() {

110 if (Index >= getChildCount())

111 return nullptr;

112

113 return getChildAtIndex(Index++);

114}

115

116void NativeEnumEnumEnumerators::reset() { Index = 0; }

117

122

128

130

135

137 Indent);

140 RecurseIdFields);

147 RecurseIdFields);

164}

165

166std::unique_ptr

169 return std::make_unique<NullEnumerator>();

170

174 else

176 return std::make_unique(Session, *ClassParent);

177}

178

180

184

185 Session.getSymbolCache().findSymbolByTypeIndex(Record->getUnderlyingType());

186

188

189

190 if (!Underlying.isSimple() ||

193 }

194

195 switch (Underlying.getSimpleKind()) {

249 default:

251 }

253}

254

258

266

274

282

289

297

301

302 const auto Id = Session.getSymbolCache().findSymbolByTypeIndex(

303 Record->getUnderlyingType());

304 const auto UnderlyingType =

306 return UnderlyingType ? UnderlyingType->getLength() : 0;

307}

308

312

313 return std::string(Record->getName());

314}

315

322

330

337

344

348

349 return Session.getSymbolCache().findSymbolByTypeIndex(

350 Record->getUnderlyingType());

351}

352

354

356

358

365

372

379

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static Error visitKnownMember(CVMemberRecord &Record, TypeVisitorCallbacks &Callbacks)

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Provides amortized O(1) random access to a CodeView type stream.

TypeIndex ContinuationIndex

static Error deserializeAs(CVType &CVT, T &Record)

NativeRawSymbol(NativeSession &PDBSession, PDB_SymType Tag, SymIndexId SymbolId)

void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields, PdbSymbolIdField RecurseIdFields) const override

SymbolCache & getSymbolCache()

codeview::TypeIndex Index

bool isVolatileType() const override

Definition NativeTypeEnum.cpp:366

bool isScoped() const override

Definition NativeTypeEnum.cpp:338

bool hasOverloadedOperator() const override

Definition NativeTypeEnum.cpp:323

bool isIntrinsic() const override

Definition NativeTypeEnum.cpp:283

bool isPacked() const override

Definition NativeTypeEnum.cpp:331

std::string getName() const override

Definition NativeTypeEnum.cpp:309

void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields, PdbSymbolIdField RecurseIdFields) const override

Definition NativeTypeEnum.cpp:131

bool hasAssignmentOperator() const override

Definition NativeTypeEnum.cpp:267

bool isNested() const override

Definition NativeTypeEnum.cpp:316

bool isValueUdt() const override

Definition NativeTypeEnum.cpp:355

bool isUnalignedType() const override

Definition NativeTypeEnum.cpp:373

bool isInterfaceUdt() const override

Definition NativeTypeEnum.cpp:357

std::unique_ptr< IPDBEnumSymbols > findChildren(PDB_SymType Type) const override

Definition NativeTypeEnum.cpp:167

bool hasCastOperator() const override

Definition NativeTypeEnum.cpp:290

PDB_BuiltinType getBuiltinType() const override

Definition NativeTypeEnum.cpp:181

bool hasConstructor() const override

Definition NativeTypeEnum.cpp:259

SymIndexId getTypeId() const override

Definition NativeTypeEnum.cpp:345

bool isConstType() const override

Definition NativeTypeEnum.cpp:359

const NativeTypeBuiltin & getUnderlyingBuiltinType() const

Definition NativeTypeEnum.cpp:380

bool hasNestedTypes() const override

Definition NativeTypeEnum.cpp:275

PDB_SymType getSymTag() const override

Definition NativeTypeEnum.cpp:179

SymIndexId getUnmodifiedTypeId() const override

Definition NativeTypeEnum.cpp:255

std::optional< codeview::ModifierRecord > Modifiers

~NativeTypeEnum() override

NativeTypeEnum * UnmodifiedType

uint64_t getLength() const override

Definition NativeTypeEnum.cpp:298

std::optional< codeview::EnumRecord > Record

bool isRefUdt() const override

Definition NativeTypeEnum.cpp:353

NativeTypeEnum(NativeSession &Session, SymIndexId Id, codeview::TypeIndex TI, codeview::EnumRecord Record)

Definition NativeTypeEnum.cpp:118

Expected< TpiStream & > getPDBTpiStream()

SymIndexId getOrCreateFieldListMember(codeview::TypeIndex FieldListTI, uint32_t Index, Args &&... ConstructorArgs)

LLVM_ABI std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const

codeview::LazyRandomTypeCollection & typeCollection()

This class implements an extremely fast bulk output stream that can only output to a stream.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

CVRecord< TypeLeafKind > CVType

@ HasConstructorOrDestructor

@ HasOverloadedAssignmentOperator

LLVM_ABI Error visitMemberRecordStream(ArrayRef< uint8_t > FieldList, TypeVisitorCallbacks &Callbacks)

@ Float32PartialPrecision

@ Complex32PartialPrecision

void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent)

PDB_BuiltinType

These values correspond to the Basictype enumeration, and are documented here: https://msdn....

PDB_SymType

These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn....

IPDBEnumChildren< PDBSymbol > IPDBEnumSymbols

LLVM_ABI void dumpSymbolIdField(raw_ostream &OS, StringRef Name, SymIndexId Value, int Indent, const IPDBSession &Session, PdbSymbolIdField FieldId, PdbSymbolIdField ShowFlags, PdbSymbolIdField RecurseFlags)

This is an optimization pass for GlobalISel generic memory operations.

void cantFail(Error Err, const char *Msg=nullptr)

Report a fatal error if Err is a failure value.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

Implement std::hash so that hash_code can be used in STL containers.