================
@@ -1335,6 +1336,43 @@ void 
DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
   }
 }
 
+void DeclPrinter::VisitExplicitInstantiationDecl(ExplicitInstantiationDecl *D) 
{
+  if (D->isExternTemplate())
+    Out << "extern ";
+  Out << "template ";
+
+  NamedDecl *Spec = D->getSpecialization();
+
+  // Build the qualified name with template arguments.
+  std::string Name;
+  llvm::raw_string_ostream NameOS(Name);
+  if (D->getQualifierLoc())
+    D->getQualifierLoc().getNestedNameSpecifier().print(NameOS, Policy);
+  Spec->printName(NameOS, Policy);
+  if (auto *ArgsAsWritten = D->getTemplateArgsAsWritten())
+    printTemplateArgumentList(NameOS, ArgsAsWritten->arguments(), Policy);
+
+  if (auto *RD = dyn_cast<RecordDecl>(Spec)) {
+    Out << RD->getKindName() << " " << Name;
+  } else if (auto *FD = dyn_cast<FunctionDecl>(Spec)) {
+    FD->getReturnType().print(Out, Policy);
+    Out << " " << Name << "(";
+    for (unsigned I = 0, N = FD->getNumParams(); I < N; ++I) {
+      if (I)
+        Out << ", ";
----------------
zwuis wrote:

It's up to you, but we could use `llvm::ListSeparator`.

https://github.com/llvm/llvm-project/pull/191658
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to