[PATCH] D63031: DebugInfo: Render the canonical name of a class template specialization, even when nested in another class template specialization
This revision was automatically updated to reflect the committed changes. Closed by commit rG9fdd09a4ccd0: DebugInfo: Render the canonical name of a class template specialization, even… (authored by dblaikie). Changed prior to commit: https://reviews.llvm.org/D63031?vs=203639=225718#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63031/new/ https://reviews.llvm.org/D63031 Files: clang/lib/AST/TypePrinter.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp Index: clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp === --- clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp +++ clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp @@ -105,7 +105,12 @@ }; extern template class j; j jj; +template +struct j_wrap { +}; +j_wrap> j_wrap_j; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j" +// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap >" template struct k { Index: clang/lib/CodeGen/CGDebugInfo.cpp === --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -314,7 +314,9 @@ if (isa(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: clang/lib/AST/TypePrinter.cpp === --- clang/lib/AST/TypePrinter.cpp +++ clang/lib/AST/TypePrinter.cpp @@ -1204,7 +1204,8 @@ // arguments. if (const auto *Spec = dyn_cast(D)) { ArrayRef Args; -if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) { +TypeSourceInfo *TAW = Spec->getTypeAsWritten(); +if (!Policy.PrintCanonicalTypes && TAW) { const TemplateSpecializationType *TST = cast(TAW->getType()); Args = TST->template_arguments(); Index: clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp === --- clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp +++ clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp @@ -105,7 +105,12 @@ }; extern template class j; j jj; +template +struct j_wrap { +}; +j_wrap> j_wrap_j; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j" +// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap >" template struct k { Index: clang/lib/CodeGen/CGDebugInfo.cpp === --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -314,7 +314,9 @@ if (isa(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: clang/lib/AST/TypePrinter.cpp === --- clang/lib/AST/TypePrinter.cpp +++ clang/lib/AST/TypePrinter.cpp @@ -1204,7 +1204,8 @@ // arguments. if (const auto *Spec = dyn_cast(D)) { ArrayRef Args; -if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) { +TypeSourceInfo *TAW = Spec->getTypeAsWritten(); +if (!Policy.PrintCanonicalTypes && TAW) { const TemplateSpecializationType *TST = cast(TAW->getType()); Args = TST->template_arguments(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D63031: DebugInfo: Render the canonical name of a class template specialization, even when nested in another class template specialization
dblaikie added a comment. Some more ping (: Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63031/new/ https://reviews.llvm.org/D63031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D63031: DebugInfo: Render the canonical name of a class template specialization, even when nested in another class template specialization
dblaikie added a comment. Ping Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63031/new/ https://reviews.llvm.org/D63031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D63031: DebugInfo: Render the canonical name of a class template specialization, even when nested in another class template specialization
dblaikie marked an inline comment as done. dblaikie added a comment. Ping (just curious about the change to the canonicalization printing policy - making sure I don't break something important) Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63031/new/ https://reviews.llvm.org/D63031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D63031: DebugInfo: Render the canonical name of a class template specialization, even when nested in another class template specialization
dblaikie created this revision. dblaikie added a reviewer: rsmith. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D63031 Files: lib/AST/TypePrinter.cpp lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info-template-explicit-specialization.cpp Index: test/CodeGenCXX/debug-info-template-explicit-specialization.cpp === --- test/CodeGenCXX/debug-info-template-explicit-specialization.cpp +++ test/CodeGenCXX/debug-info-template-explicit-specialization.cpp @@ -105,7 +105,12 @@ }; extern template class j; j jj; +template +struct j_wrap { +}; +j_wrap> j_wrap_j; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j" +// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap >" template struct k { Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -313,7 +313,9 @@ if (isa(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: lib/AST/TypePrinter.cpp === --- lib/AST/TypePrinter.cpp +++ lib/AST/TypePrinter.cpp @@ -1204,7 +1204,8 @@ // arguments. if (const auto *Spec = dyn_cast(D)) { ArrayRef Args; -if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) { +TypeSourceInfo *TAW = Spec->getTypeAsWritten(); +if (!Policy.PrintCanonicalTypes && TAW) { const TemplateSpecializationType *TST = cast(TAW->getType()); Args = TST->template_arguments(); Index: test/CodeGenCXX/debug-info-template-explicit-specialization.cpp === --- test/CodeGenCXX/debug-info-template-explicit-specialization.cpp +++ test/CodeGenCXX/debug-info-template-explicit-specialization.cpp @@ -105,7 +105,12 @@ }; extern template class j; j jj; +template +struct j_wrap { +}; +j_wrap> j_wrap_j; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j" +// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap >" template struct k { Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -313,7 +313,9 @@ if (isa(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: lib/AST/TypePrinter.cpp === --- lib/AST/TypePrinter.cpp +++ lib/AST/TypePrinter.cpp @@ -1204,7 +1204,8 @@ // arguments. if (const auto *Spec = dyn_cast(D)) { ArrayRef Args; -if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) { +TypeSourceInfo *TAW = Spec->getTypeAsWritten(); +if (!Policy.PrintCanonicalTypes && TAW) { const TemplateSpecializationType *TST = cast(TAW->getType()); Args = TST->template_arguments(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits