]> granicus.if.org Git - clang/commitdiff
DebugInfo: Render the canonical name of a class template specialization, even when...
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 18 Oct 2019 23:58:34 +0000 (23:58 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 18 Oct 2019 23:58:34 +0000 (23:58 +0000)
Differential Revision: https://reviews.llvm.org/D63031

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375304 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/TypePrinter.cpp
lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info-template-explicit-specialization.cpp

index d7b7103faaa94cfcc03cf9273b57809ccf06ebfa..dacbf9a96d814ecd524ed01dd93a43e471730b9a 100644 (file)
@@ -1204,7 +1204,8 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream &OS) {
   // arguments.
   if (const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
     ArrayRef<TemplateArgument> Args;
-    if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) {
+    TypeSourceInfo *TAW = Spec->getTypeAsWritten();
+    if (!Policy.PrintCanonicalTypes && TAW) {
       const TemplateSpecializationType *TST =
         cast<TemplateSpecializationType>(TAW->getType());
       Args = TST->template_arguments();
index 7962ae002b25d9dfaf594d63f918e13f154c4260..294d54e37883f020f90e8e3b84fcd20cbbceac9e 100644 (file)
@@ -314,7 +314,9 @@ StringRef CGDebugInfo::getClassName(const RecordDecl *RD) {
   if (isa<ClassTemplateSpecializationDecl>(RD)) {
     SmallString<128> Name;
     llvm::raw_svector_ostream OS(Name);
-    RD->getNameForDiagnostic(OS, getPrintingPolicy(),
+    PrintingPolicy PP = getPrintingPolicy();
+    PP.PrintCanonicalTypes = true;
+    RD->getNameForDiagnostic(OS, PP,
                              /*Qualified*/ false);
 
     // Copy this name on the side and use its reference.
index cd51b522505d2bfc0d756c3992dd75c93ab65738..4e41c4092bf4e35504edca4f0a2867b8ff2c84e5 100644 (file)
@@ -105,7 +105,12 @@ struct j {
 };
 extern template class j<int>;
 j<int> jj;
+template <typename T>
+struct j_wrap {
+};
+j_wrap<j<int>> j_wrap_j;
 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j<int, int>"
+// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap<j<int, int> >"
 
 template <typename T>
 struct k {