65 : Session(Session), Dbi(Dbi) {
67 Cache.push_back(
nullptr);
73 std::unique_ptr<IPDBEnumSymbols>
78 std::unique_ptr<IPDBEnumSymbols>
85 auto &Types = Tpi->typeCollection();
86 return std::unique_ptr<IPDBEnumSymbols>(
90 std::unique_ptr<IPDBEnumSymbols>
92 return std::unique_ptr<IPDBEnumSymbols>(
99 return createSymbol<NativeTypePointer>(Index);
107 return createSymbol<NativeTypeBuiltin>(Mods, It->Type, It->Size);
114 if (
auto EC = TypeDeserializer::deserializeAs<ModifierRecord>(CVT, Record)) {
128 return createSymbol<NativeTypeEnum>(
131 return createSymbol<NativeTypeUDT>(
132 static_cast<NativeTypeUDT &
>(UnmodifiedNRS), std::move(Record));
136 assert(
false &&
"Invalid LF_MODIFIER record");
144 const auto Entry = TypeIndexToSymbolId.find(Index);
145 if (Entry != TypeIndexToSymbolId.end())
146 return Entry->second;
151 assert(TypeIndexToSymbolId.count(Index) == 0);
152 TypeIndexToSymbolId[
Index] = Result;
170 else if (*EFD != Index) {
175 assert(TypeIndexToSymbolId.count(Index) == 0);
176 TypeIndexToSymbolId[
Index] = Result;
184 switch (CVT.
kind()) {
185 case codeview::LF_ENUM:
186 Id = createSymbolForType<NativeTypeEnum, EnumRecord>(
Index, std::move(CVT));
188 case codeview::LF_ARRAY:
189 Id = createSymbolForType<NativeTypeArray, ArrayRecord>(
Index,
192 case codeview::LF_CLASS:
193 case codeview::LF_STRUCTURE:
194 case codeview::LF_INTERFACE:
195 Id = createSymbolForType<NativeTypeUDT, ClassRecord>(
Index, std::move(CVT));
197 case codeview::LF_UNION:
198 Id = createSymbolForType<NativeTypeUDT, UnionRecord>(
Index, std::move(CVT));
200 case codeview::LF_POINTER:
201 Id = createSymbolForType<NativeTypePointer, PointerRecord>(
Index,
204 case codeview::LF_MODIFIER:
205 Id = createSymbolForModifiedType(Index, std::move(CVT));
207 case codeview::LF_PROCEDURE:
208 Id = createSymbolForType<NativeTypeFunctionSig, ProcedureRecord>(
209 Index, std::move(CVT));
211 case codeview::LF_MFUNCTION:
212 Id = createSymbolForType<NativeTypeFunctionSig, MemberFunctionRecord>(
213 Index, std::move(CVT));
215 case codeview::LF_VTSHAPE:
216 Id = createSymbolForType<NativeTypeVTShape, VFTableShapeRecord>(
217 Index, std::move(CVT));
220 Id = createSymbolPlaceholder();
224 assert(TypeIndexToSymbolId.count(Index) == 0);
225 TypeIndexToSymbolId[
Index] =
Id;
230 std::unique_ptr<PDBSymbol>
232 assert(SymbolId < Cache.size());
235 if (SymbolId == 0 || SymbolId >= Cache.size())
248 return *Cache[SymbolId];
259 auto Iter = GlobalOffsetToSymbolId.find(Offset);
260 if (Iter != GlobalOffsetToSymbolId.end())
264 CVSymbol CVS = SS.readRecord(Offset);
266 switch (CVS.
kind()) {
267 case SymbolKind::S_UDT: {
268 UDTSym US =
cantFail(SymbolDeserializer::deserializeAs<UDTSym>(CVS));
269 Id = createSymbol<NativeTypeTypedef>(std::move(US));
273 Id = createSymbolPlaceholder();
277 assert(GlobalOffsetToSymbolId.count(Offset) == 0);
278 GlobalOffsetToSymbolId[
Offset] =
Id;
284 std::unique_ptr<PDBSymbolCompiland>
289 if (Index >= Compilands.size())
292 if (Compilands[Index] == 0) {
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
std::unique_ptr< IPDBEnumSymbols > createGlobalsEnumerator(codeview::SymbolKind Kind)
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
std::unique_ptr< IPDBEnumSymbols > createTypeEnumerator(codeview::TypeLeafKind Kind)
codeview::SimpleTypeKind Kind
SimpleTypeKind getSimpleKind() const
DbiModuleDescriptor getModuleDescriptor(uint32_t Modi) const
Error takeError()
Take ownership of the stored error.
bool isUdtForwardRef(CVType CVT)
Given an arbitrary codeview type, determine if it is an LF_STRUCTURE, LF_CLASS, LF_INTERFACE, LF_UNION, or LF_ENUM with the forward ref class option.
Expected< TpiStream & > getPDBTpiStream()
static const struct BuiltinTypeEntry BuiltinTypes[]
SimpleTypeMode getSimpleMode() const
uint32_t getModuleCount() const
std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const
Tagged union holding either a T or a Error.
CVType getType(TypeIndex Index) override
std::unique_ptr< PDBSymbolCompiland > getOrCreateCompiland(uint32_t Index)
ModifierOptions
Equivalent to CV_modifier_t.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
Expected< SymbolStream & > getPDBSymbolStream()
const DbiModuleList & modules() const
ModifierOptions Modifiers
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
std::unique_ptr< T > getConcreteSymbolById(SymIndexId SymbolId) const
void consumeError(Error Err)
Consume a Error without doing anything.
SymIndexId getOrCreateGlobalSymbolByOffset(uint32_t Offset)
NativeRawSymbol & getNativeSymbolById(SymIndexId SymbolId) const
SymIndexId findSymbolByTypeIndex(codeview::TypeIndex TI)
PDB_SymType getSymTag() const override
uint32_t getNumCompilands() const
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
PDB_BuiltinType
These values correspond to the Basictype enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static std::unique_ptr< PDBSymbol > create(const IPDBSession &PDBSession, std::unique_ptr< IPDBRawSymbol > RawSymbol)
Provides amortized O(1) random access to a CodeView type stream.