[clang] db6f1e8 - DebugInfo: Don't suppress inline namespaces when printing template template parameter names
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 21 19:30:31 PDT 2021
Author: David Blaikie
Date: 2021-09-21T19:30:13-07:00
New Revision: db6f1e8a8857ccaa339304131373f3150528e812
URL: https://github.com/llvm/llvm-project/commit/db6f1e8a8857ccaa339304131373f3150528e812
DIFF: https://github.com/llvm/llvm-project/commit/db6f1e8a8857ccaa339304131373f3150528e812.diff
LOG: DebugInfo: Don't suppress inline namespaces when printing template template parameter names
Added:
Modified:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-template.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 37d53dfbc7014..8660e23726b35 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2066,11 +2066,15 @@ CGDebugInfo::CollectTemplateParams(Optional<TemplateArgs> OArgs,
TemplateParams.push_back(DBuilder.createTemplateValueParameter(
TheCU, Name, TTy, defaultParameter, V));
} break;
- case TemplateArgument::Template:
+ case TemplateArgument::Template: {
+ std::string QualName;
+ llvm::raw_string_ostream OS(QualName);
+ TA.getAsTemplate().getAsTemplateDecl()->printQualifiedName(
+ OS, getPrintingPolicy());
TemplateParams.push_back(DBuilder.createTemplateTemplateParameter(
- TheCU, Name, nullptr,
- TA.getAsTemplate().getAsTemplateDecl()->getQualifiedNameAsString()));
+ TheCU, Name, nullptr, OS.str()));
break;
+ }
case TemplateArgument::Pack:
TemplateParams.push_back(DBuilder.createTemplateParameterPack(
TheCU, Name, nullptr,
diff --git a/clang/test/CodeGenCXX/debug-info-template.cpp b/clang/test/CodeGenCXX/debug-info-template.cpp
index d536cc5d34c33..546fe01833a7c 100644
--- a/clang/test/CodeGenCXX/debug-info-template.cpp
+++ b/clang/test/CodeGenCXX/debug-info-template.cpp
@@ -245,3 +245,16 @@ void f1() {}
template void f1<decltype(nullptr)>();
// CHECK: !DISubprogram(name: "f1<std::nullptr_t>",
} // namespace Nullptr_t
+
+namespace TemplateTemplateParamInlineNamespace {
+inline namespace inl {
+ template<typename>
+ struct t1 { };
+} // namespace inl
+template<template<typename> class> void f1() { }
+template void f1<t1>();
+// CHECK: !DISubprogram(name: "f1<TemplateTemplateParamInlineNamespace::inl::t1>",
+// CHECK-SAME: templateParams: ![[TEMP_TEMP_INL_ARGS:[0-9]*]],
+// CHECK: ![[TEMP_TEMP_INL_ARGS]] = !{![[TEMP_TEMP_INL_ARGS_T:[0-9]*]]}
+// CHECK: ![[TEMP_TEMP_INL_ARGS_T]] = !DITemplateValueParameter(tag: DW_TAG_GNU_template_template_param, value: !"TemplateTemplateParamInlineNamespace::inl::t1")
+} // namespace TemplateTemplateParamInlineNamespace
More information about the cfe-commits
mailing list