<div dir="ltr">I'm roughly where I was before, I think:<br><br>"<span style="color:rgb(33,33,33)">In any case, it seems like it might make sense for you to upstream your template naming change and put it under the PS4 debugger tuning option, and put this change there too, once the motivation for it is in-tree. At that point, while I'd be curious about the size tradeoff, it'd be essentially academic."<br><br>Basically without the naming change in-tree, there seems to be a lack of motivation for this change. I'd prefer/recommend/suggest keeping this change wherever that change is. (so if the naming change is upstreamed (conditional/behind the PS4 debugger tuning flag) then I agree this could/should go in similarly)<br><br>- Dave</span></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 11, 2017 at 10:34 AM Paul Robinson via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">probinson updated this revision to Diff 106063.<br>
probinson added a comment.<br>
<br>
Refresh to current TOT, and ping.  Funny what you can find in a year-old to-do list....<br>
<br>
<br>
<a href="https://reviews.llvm.org/D14358" rel="noreferrer" target="_blank">https://reviews.llvm.org/D14358</a><br>
<br>
Files:<br>
  lib/CodeGen/CGDebugInfo.cpp<br>
  test/CodeGenCXX/debug-info-template-fwd-param.cpp<br>
  test/Modules/ExtDebugInfo.cpp<br>
<br>
<br>
Index: test/Modules/ExtDebugInfo.cpp<br>
===================================================================<br>
--- test/Modules/ExtDebugInfo.cpp<br>
+++ test/Modules/ExtDebugInfo.cpp<br>
@@ -93,9 +93,13 @@<br>
 // CHECK-SAME:             flags: DIFlagFwdDecl,<br>
 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE")<br>
<br>
-// This type isn't, however, even with standalone non-module debug info this<br>
-// type is a forward declaration.<br>
-// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "traits<int>",<br>
+// This type isn't, however, it is a template parameter type and so gets a<br>
+// forward declaration.<br>
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type,<br>
+// CHECK-SAME:             name: "traits<int>",<br>
+// CHECK-SAME:             scope: ![[NS]],<br>
+// CHECK-SAME:             flags: DIFlagFwdDecl,<br>
+// CHECK-SAME:             identifier: "_ZTSN8DebugCXX6traitsIiEE")<br>
<br>
 // This one isn't.<br>
 // CHECK: !DICompositeType(tag: DW_TAG_class_type,<br>
Index: test/CodeGenCXX/debug-info-template-fwd-param.cpp<br>
===================================================================<br>
--- test/CodeGenCXX/debug-info-template-fwd-param.cpp<br>
+++ test/CodeGenCXX/debug-info-template-fwd-param.cpp<br>
@@ -0,0 +1,25 @@<br>
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -debug-info-kind=limited -emit-llvm -o - | FileCheck %s<br>
+// A forward declaration of a template should still have template parameters.<br>
+<br>
+template<typename T> class A {<br>
+public:<br>
+  A(T val);<br>
+private:<br>
+  T x;<br>
+};<br>
+<br>
+struct B {<br>
+  A<const int> *p;<br>
+};<br>
+<br>
+B b;<br>
+<br>
+// CHECK:      !DICompositeType(tag: DW_TAG_class_type, name: "A<const int>"<br>
+// CHECK-SAME:     flags: DIFlagFwdDecl<br>
+// CHECK-SAME:     templateParams: [[PARAM_LIST:![0-9]*]]<br>
+// CHECK:      [[PARAM_LIST]] = !{[[PARAM:![0-9]*]]}<br>
+// CHECK:      [[PARAM]] = !DITemplateTypeParameter(name: "T",<br>
+// CHECK-SAME:     type: [[CTYPE:![0-9]*]]<br>
+// CHECK:      [[CTYPE]] = !DIDerivedType(tag: DW_TAG_const_type<br>
+// CHECK-SAME:     baseType: [[BTYPE:![0-9]*]]<br>
+// CHECK:      [[BTYPE]] = !DIBasicType(name: "int"<br>
Index: lib/CodeGen/CGDebugInfo.cpp<br>
===================================================================<br>
--- lib/CodeGen/CGDebugInfo.cpp<br>
+++ lib/CodeGen/CGDebugInfo.cpp<br>
@@ -805,6 +805,10 @@<br>
   llvm::DICompositeType *RetTy = DBuilder.createReplaceableCompositeType(<br>
       getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, Size, Align,<br>
       llvm::DINode::FlagFwdDecl, FullName);<br>
+  if (const ClassTemplateSpecializationDecl *TSpecial =<br>
+          dyn_cast<ClassTemplateSpecializationDecl>(RD))<br>
+    DBuilder.replaceArrays(RetTy, llvm::DINodeArray(),<br>
+                           CollectCXXTemplateParams(TSpecial, DefUnit));<br>
   ReplaceMap.emplace_back(<br>
       std::piecewise_construct, std::make_tuple(Ty),<br>
       std::make_tuple(static_cast<llvm::Metadata *>(RetTy)));<br>
<br>
<br>
</blockquote></div>