Author: David Blaikie
Date: 2021-04-08T17:37:55-07:00
New Revision: eb8a28e2cf033f2bfbfe33a0bd0d9e75a12e2679

URL: 
https://github.com/llvm/llvm-project/commit/eb8a28e2cf033f2bfbfe33a0bd0d9e75a12e2679
DIFF: 
https://github.com/llvm/llvm-project/commit/eb8a28e2cf033f2bfbfe33a0bd0d9e75a12e2679.diff

LOG: 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).

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 3fe56346088c7..455552a5ea6d2 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 a6edd59171b29..4342b3e27a0b2 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>",


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to