static std::pair<size_t, bool> GetIntegralTypeInfo(TypeIndex ti, TpiStream &tpi) { if (ti.isSimple()) { SimpleTypeKind stk = ti.getSimpleKind(); return {GetTypeSizeForSimpleKind(stk), IsSimpleTypeSignedInteger(stk)}; } CVType cvt = tpi.getType(ti); switch (cvt.kind()) { case LF_MODIFIER: { ModifierRecord mfr; llvm::cantFail(TypeDeserializer::deserializeAs<ModifierRecord>(cvt, mfr)); return GetIntegralTypeInfo(mfr.ModifiedType, tpi); } case LF_POINTER: { PointerRecord pr; llvm::cantFail(TypeDeserializer::deserializeAs<PointerRecord>(cvt, pr)); return GetIntegralTypeInfo(pr.ReferentType, tpi); } case LF_ENUM: { EnumRecord er; llvm::cantFail(TypeDeserializer::deserializeAs<EnumRecord>(cvt, er)); return GetIntegralTypeInfo(er.UnderlyingType, tpi); } default: assert(false && "Type is not integral!"); return {0, false}; } }
PdbTypeSymId lldb_private::npdb::GetBestPossibleDecl(PdbTypeSymId id, TpiStream &tpi) { if (id.index.isSimple()) return id; CVType cvt = tpi.getType(id.index); // Only tag records have a best and a worst record. if (!IsTagRecord(cvt)) return id; // Tag records that are not forward decls are full decls, hence they are the // best. if (!IsForwardRefUdt(cvt)) return id; return llvm::cantFail(tpi.findFullDeclForForwardRef(id.index)); }
bool lldb_private::npdb::IsTagRecord(const PdbTypeSymId &id, TpiStream &tpi) { if (id.is_ipi || id.index.isSimple()) return false; return IsTagRecord(tpi.getType(id.index)); }