[PATCH] D59354: [clangd] Print arguments in template specializations

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 04:09:22 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/AST.cpp:57
+    return Func->getTemplateSpecializationArgsAsWritten()->arguments();
+  if (auto *Cls = llvm::dyn_cast<ClassTemplatePartialSpecializationDecl>(&ND))
+    return Cls->getTemplateArgsAsWritten()->arguments();
----------------
For `ClassTemplateSpecializationDecl`, could we try extracting the arguments from the result of `getTypeAsWritten`?


================
Comment at: clang/lib/AST/TypePrinter.cpp:1636
+static void printArgument(const TemplateArgument &A,
+                                const PrintingPolicy &PP,
+                                llvm::raw_ostream &OS) {
----------------
NIT: clang-format the diff


================
Comment at: clang/lib/AST/TypePrinter.cpp:1644
+                                llvm::raw_ostream &OS) {
+  A.getTypeSourceInfo()->getType().print(OS, PP);
+}
----------------
Maybe print the result of `getTypeLoc()` here, if it's available?
Would produce results closer to the ones written in the code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59354/new/

https://reviews.llvm.org/D59354





More information about the cfe-commits mailing list