[PATCH] D59639: [clangd] Print template arguments helper
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 21 08:38:10 PDT 2019
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clangd/AST.cpp:26
+llvm::Optional<llvm::ArrayRef<TemplateArgumentLoc>>
+getTemplateSpecializationArgLocs(const NamedDecl &ND) {
+ if (auto *Func = llvm::dyn_cast<FunctionDecl>(&ND)) {
----------------
Functions should be static, not in anonymous namespace. See LLVM Coding Guidelines.
================
Comment at: clang-tools-extra/clangd/AST.cpp:28
+ if (auto *Func = llvm::dyn_cast<FunctionDecl>(&ND)) {
+ if (auto *Args = Func->getTemplateSpecializationArgsAsWritten())
+ return Args->arguments();
----------------
Return type is not obvious, so auto should not be used.
================
Comment at: clang-tools-extra/clangd/AST.cpp:131
+ PrintingPolicy Policy(ND.getASTContext().getLangOpts());
+ if (auto Args = getTemplateSpecializationArgLocs(ND))
+ printTemplateArgumentList(OS, *Args, Policy);
----------------
Return type is not obvious, so auto should not be used.
================
Comment at: clang/lib/AST/TypePrinter.cpp:1642
+ const PrintingPolicy &PP, llvm::raw_ostream &OS) {
+ const auto &Kind = A.getArgument().getKind();
+ assert(Kind != TemplateArgument::Null &&
----------------
Return type is not obvious, so auto should not be used.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59639/new/
https://reviews.llvm.org/D59639
More information about the cfe-commits
mailing list