Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
Show First 20 Lines • Show All 1,356 Lines • ▼ Show 20 Lines | MetadataList.assignValue( | ||||
getDITypeRefOrNull(Record[6]), Record[7], Record[8], | getDITypeRefOrNull(Record[6]), Record[7], Record[8], | ||||
Record[9], DWARFAddressSpace, Flags, | Record[9], DWARFAddressSpace, Flags, | ||||
getDITypeRefOrNull(Record[11]))), | getDITypeRefOrNull(Record[11]))), | ||||
NextMetadataNo); | NextMetadataNo); | ||||
NextMetadataNo++; | NextMetadataNo++; | ||||
break; | break; | ||||
} | } | ||||
case bitc::METADATA_COMPOSITE_TYPE: { | case bitc::METADATA_COMPOSITE_TYPE: { | ||||
if (Record.size() < 16 || Record.size() > 20) | if (Record.size() < 16 || Record.size() > 21) | ||||
return error("Invalid record"); | return error("Invalid record"); | ||||
// If we have a UUID and this is not a forward declaration, lookup the | // If we have a UUID and this is not a forward declaration, lookup the | ||||
// mapping. | // mapping. | ||||
IsDistinct = Record[0] & 0x1; | IsDistinct = Record[0] & 0x1; | ||||
bool IsNotUsedInTypeRef = Record[0] >= 2; | bool IsNotUsedInTypeRef = Record[0] >= 2; | ||||
unsigned Tag = Record[1]; | unsigned Tag = Record[1]; | ||||
MDString *Name = getMDString(Record[2]); | MDString *Name = getMDString(Record[2]); | ||||
Show All 10 Lines | case bitc::METADATA_COMPOSITE_TYPE: { | ||||
Metadata *Elements = nullptr; | Metadata *Elements = nullptr; | ||||
unsigned RuntimeLang = Record[12]; | unsigned RuntimeLang = Record[12]; | ||||
Metadata *VTableHolder = nullptr; | Metadata *VTableHolder = nullptr; | ||||
Metadata *TemplateParams = nullptr; | Metadata *TemplateParams = nullptr; | ||||
Metadata *Discriminator = nullptr; | Metadata *Discriminator = nullptr; | ||||
Metadata *DataLocation = nullptr; | Metadata *DataLocation = nullptr; | ||||
Metadata *Associated = nullptr; | Metadata *Associated = nullptr; | ||||
Metadata *Allocated = nullptr; | Metadata *Allocated = nullptr; | ||||
Metadata *Rank = nullptr; | |||||
auto *Identifier = getMDString(Record[15]); | auto *Identifier = getMDString(Record[15]); | ||||
// If this module is being parsed so that it can be ThinLTO imported | // If this module is being parsed so that it can be ThinLTO imported | ||||
// into another module, composite types only need to be imported | // into another module, composite types only need to be imported | ||||
// as type declarations (unless full type definitions requested). | // as type declarations (unless full type definitions requested). | ||||
// Create type declarations up front to save memory. Also, buildODRType | // Create type declarations up front to save memory. Also, buildODRType | ||||
// handles the case where this is type ODRed with a definition needed | // handles the case where this is type ODRed with a definition needed | ||||
// by the importing module, in which case the existing definition is | // by the importing module, in which case the existing definition is | ||||
// used. | // used. | ||||
Show All 12 Lines | if (IsImporting && !ImportFullTypeDefinitions && Identifier && | ||||
if (Record.size() > 16) | if (Record.size() > 16) | ||||
Discriminator = getMDOrNull(Record[16]); | Discriminator = getMDOrNull(Record[16]); | ||||
if (Record.size() > 17) | if (Record.size() > 17) | ||||
DataLocation = getMDOrNull(Record[17]); | DataLocation = getMDOrNull(Record[17]); | ||||
if (Record.size() > 19) { | if (Record.size() > 19) { | ||||
Associated = getMDOrNull(Record[18]); | Associated = getMDOrNull(Record[18]); | ||||
Allocated = getMDOrNull(Record[19]); | Allocated = getMDOrNull(Record[19]); | ||||
} | } | ||||
if (Record.size() > 20) { | |||||
Rank = getMDOrNull(Record[20]); | |||||
} | |||||
} | } | ||||
DICompositeType *CT = nullptr; | DICompositeType *CT = nullptr; | ||||
if (Identifier) | if (Identifier) | ||||
CT = DICompositeType::buildODRType( | CT = DICompositeType::buildODRType( | ||||
Context, *Identifier, Tag, Name, File, Line, Scope, BaseType, | Context, *Identifier, Tag, Name, File, Line, Scope, BaseType, | ||||
SizeInBits, AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang, | SizeInBits, AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang, | ||||
VTableHolder, TemplateParams, Discriminator, DataLocation, Associated, | VTableHolder, TemplateParams, Discriminator, DataLocation, Associated, | ||||
Allocated); | Allocated, Rank); | ||||
// Create a node if we didn't get a lazy ODR type. | // Create a node if we didn't get a lazy ODR type. | ||||
if (!CT) | if (!CT) | ||||
CT = GET_OR_DISTINCT(DICompositeType, | CT = GET_OR_DISTINCT(DICompositeType, | ||||
(Context, Tag, Name, File, Line, Scope, BaseType, | (Context, Tag, Name, File, Line, Scope, BaseType, | ||||
SizeInBits, AlignInBits, OffsetInBits, Flags, | SizeInBits, AlignInBits, OffsetInBits, Flags, | ||||
Elements, RuntimeLang, VTableHolder, TemplateParams, | Elements, RuntimeLang, VTableHolder, TemplateParams, | ||||
Identifier, Discriminator, DataLocation, Associated, | Identifier, Discriminator, DataLocation, Associated, | ||||
Allocated)); | Allocated, Rank)); | ||||
if (!IsNotUsedInTypeRef && Identifier) | if (!IsNotUsedInTypeRef && Identifier) | ||||
MetadataList.addTypeRef(*Identifier, *cast<DICompositeType>(CT)); | MetadataList.addTypeRef(*Identifier, *cast<DICompositeType>(CT)); | ||||
MetadataList.assignValue(CT, NextMetadataNo); | MetadataList.assignValue(CT, NextMetadataNo); | ||||
NextMetadataNo++; | NextMetadataNo++; | ||||
break; | break; | ||||
} | } | ||||
case bitc::METADATA_SUBROUTINE_TYPE: { | case bitc::METADATA_SUBROUTINE_TYPE: { | ||||
▲ Show 20 Lines • Show All 787 Lines • Show Last 20 Lines |