aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2022-04-05 21:28:10 +0000
committerDavid Blaikie <dblaikie@gmail.com>2022-04-05 21:29:58 +0000
commit6302a91468ebcaeac63951f9c89da9d89bc38ede (patch)
tree642e2c4260101d07f0887f0fc8a2ffd42691e164 /llvm/lib/Bitcode/Reader/MetadataLoader.cpp
parented9a14f912c034c6a7177d4bc8a2d41a22b3e129 (diff)
downloadllvm-6302a91468ebcaeac63951f9c89da9d89bc38ede.zip
llvm-6302a91468ebcaeac63951f9c89da9d89bc38ede.tar.gz
llvm-6302a91468ebcaeac63951f9c89da9d89bc38ede.tar.bz2
DebugInfo: ThinLTO: Import template parameters on type declarations
Necessary when importing class template specializations that have simplified template names (may otherwise be necessary - eg: Sony requires template parameter DIEs even with unsimplified names, but short of always importing names this is the best I can do for now) - long term this probably needs a flag for the DICompositeType to specify whether it needs template parameters on declarations & that flag could power this behavior, rather than inspecting the name.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index fb5491a..7d097bb 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1503,6 +1503,15 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
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.startswith("_STN"))
+ TemplateParams = getMDOrNull(Record[14]);
+ }
} else {
BaseType = getDITypeRefOrNull(Record[6]);
OffsetInBits = Record[9];