diff options
author | David Blaikie <dblaikie@gmail.com> | 2021-04-08 17:36:41 -0700 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2021-04-08 17:37:55 -0700 |
commit | eb8a28e2cf033f2bfbfe33a0bd0d9e75a12e2679 (patch) | |
tree | 8f001cbca031b2768cc0530203937a0054201f42 | |
parent | 8294019633b527f3c5d529e9ae2bac1d5af66361 (diff) | |
download | llvm-eb8a28e2cf033f2bfbfe33a0bd0d9e75a12e2679.tar.gz |
DebugInfo: Include inline namespaces in template specialization parameter names
This ensures these types have distinct names if they are distinct types
(eg: if one is an instantiation with a type in one inline namespace, and
another from a type with the same simple name, but in a different inline
namespace).
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 1 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/debug-info-template.cpp | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 3fe56346088c..455552a5ea6d 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -305,6 +305,7 @@ StringRef CGDebugInfo::getClassName(const RecordDecl *RD) { llvm::raw_svector_ostream OS(Name); PrintingPolicy PP = getPrintingPolicy(); PP.PrintCanonicalTypes = true; + PP.SuppressInlineNamespace = false; RD->getNameForDiagnostic(OS, PP, /*Qualified*/ false); diff --git a/clang/test/CodeGenCXX/debug-info-template.cpp b/clang/test/CodeGenCXX/debug-info-template.cpp index a6edd59171b2..4342b3e27a0b 100644 --- a/clang/test/CodeGenCXX/debug-info-template.cpp +++ b/clang/test/CodeGenCXX/debug-info-template.cpp @@ -179,3 +179,11 @@ ClassTemplateArgRefTemplate<ClassTemplateArgObj.Arg> ClassTemplateArgRefObj; // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ClassTemplateArgRefTemplate<<template param ClassTemplateArg{1, 2.000000e+00}> >", {{.*}}, templateParams: ![[CLASS_TEMP_REF_ARGS:[0-9]*]], // CHECK: ![[CLASS_TEMP_REF_ARGS]] = !{![[CLASS_TEMP_REF_ARG:[0-9]*]]} // CHECK: ![[CLASS_TEMP_REF_ARG]] = !DITemplateValueParameter(type: ![[CLASS_TEMP_ARG_CONST_REF_TYPE]], value: %{{.*}}* @_ZTAXtl16ClassTemplateArgLi1ELf40000000EEE) + +inline namespace inl { + struct t1 { }; +} +template<typename T> struct ClassTemplateInlineNamespaceArg { +}; +ClassTemplateInlineNamespaceArg<inl::t1> ClassTemplateInlineNamespaceArgObj; +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ClassTemplateInlineNamespaceArg<inl::t1>", |