diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-01-24 19:17:23 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-06 20:13:49 +0000 |
commit | 7a6dacaca14b62ca4b74406814becb87a3fefac0 (patch) | |
tree | 273a870ac27484bb1f5ee55e7ef0dc0d061f63e7 /contrib/llvm-project/llvm/lib/Bitcode/Reader/MetadataLoader.cpp | |
parent | 46c59ea9b61755455ff6bf9f3e7b834e1af634ea (diff) | |
parent | 4df029cc74e5ec124f14a5682e44999ce4f086df (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/contrib/llvm-project/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/contrib/llvm-project/llvm/lib/Bitcode/Reader/MetadataLoader.cpp index 910e97489dbb..770eb83af17f 100644 --- a/contrib/llvm-project/llvm/lib/Bitcode/Reader/MetadataLoader.cpp +++ b/contrib/llvm-project/llvm/lib/Bitcode/Reader/MetadataLoader.cpp @@ -1615,27 +1615,32 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( Metadata *Annotations = nullptr; auto *Identifier = getMDString(Record[15]); // If this module is being parsed so that it can be ThinLTO imported - // into another module, composite types only need to be imported - // as type declarations (unless full type definitions requested). - // Create type declarations up front to save memory. Also, buildODRType - // handles the case where this is type ODRed with a definition needed - // by the importing module, in which case the existing definition is - // used. - if (IsImporting && !ImportFullTypeDefinitions && Identifier && + // into another module, composite types only need to be imported as + // type declarations (unless full type definitions are requested). + // Create type declarations up front to save memory. This is only + // done for types which have an Identifier, and are therefore + // subject to the ODR. + // + // buildODRType handles the case where this is type ODRed with a + // definition needed by the importing module, in which case the + // existing definition is used. + // + // We always import full definitions for anonymous composite types, + // as without a name, debuggers cannot easily resolve a declaration + // to its definition. + if (IsImporting && !ImportFullTypeDefinitions && Identifier && Name && (Tag == dwarf::DW_TAG_enumeration_type || Tag == dwarf::DW_TAG_class_type || Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type)) { Flags = Flags | DINode::FlagFwdDecl; - if (Name) { - // This is a hack around preserving template parameters for simplified - // template names - it should probably be replaced with a - // DICompositeType flag specifying whether template parameters are - // required on declarations of this type. - StringRef NameStr = Name->getString(); - if (!NameStr.contains('<') || NameStr.starts_with("_STN|")) - TemplateParams = getMDOrNull(Record[14]); - } + // This is a hack around preserving template parameters for simplified + // template names - it should probably be replaced with a + // DICompositeType flag specifying whether template parameters are + // required on declarations of this type. + StringRef NameStr = Name->getString(); + if (!NameStr.contains('<') || NameStr.starts_with("_STN|")) + TemplateParams = getMDOrNull(Record[14]); } else { BaseType = getDITypeRefOrNull(Record[6]); OffsetInBits = Record[9]; |