From 8d6a9c05f6d676c93c84ebf06cf6263657e74c00 Mon Sep 17 00:00:00 2001 From: Orlando Cazalet-Hyams Date: Thu, 18 Apr 2024 12:08:31 +0100 Subject: [DWARF] Add support for DW_TAG_template_alias for template aliases (#88943) Part 1 of fix for issue https://github.com/llvm/llvm-project/issues/54624 Split from PR #87623. Clang front end changes to follow. Use DICompositeType to represent the template alias, using its extraData field as a tuple of DITemplateParameter to describe the template parameters. Added template-alias.ll - Check DWARF emission. Modified frame-types.s - Check llvm-symbolizer understands the DIE. --- llvm/lib/IR/DIBuilder.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'llvm/lib/IR/DIBuilder.cpp') diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index f86e557..f39149a 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -356,6 +356,17 @@ DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name, nullptr, Annotations); } +DIDerivedType * +DIBuilder::createTemplateAlias(DIType *Ty, StringRef Name, DIFile *File, + unsigned LineNo, DIScope *Context, + DINodeArray TParams, uint32_t AlignInBits, + DINode::DIFlags Flags, DINodeArray Annotations) { + return DIDerivedType::get(VMContext, dwarf::DW_TAG_template_alias, Name, File, + LineNo, getNonCompileUnitScope(Context), Ty, 0, + AlignInBits, 0, std::nullopt, std::nullopt, Flags, + TParams.get(), Annotations); +} + DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) { assert(Ty && "Invalid type!"); assert(FriendTy && "Invalid friend type!"); -- cgit v1.1