[PATCH] D65926: [clangd] Fixed printTemplateSpecializationArgs not printing partial variable specialization arguments.
Johan Vikström via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 9 00:34:42 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368403: [clangd] Fixed printTemplateSpecializationArgs not printing partial variable… (authored by jvikstrom, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D65926?vs=214132&id=214323#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65926/new/
https://reviews.llvm.org/D65926
Files:
clang-tools-extra/trunk/clangd/AST.cpp
clang-tools-extra/trunk/clangd/unittests/ClangdUnitTests.cpp
clang-tools-extra/trunk/clangd/unittests/PrintASTTests.cpp
Index: clang-tools-extra/trunk/clangd/unittests/ClangdUnitTests.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/unittests/ClangdUnitTests.cpp
+++ clang-tools-extra/trunk/clangd/unittests/ClangdUnitTests.cpp
@@ -188,7 +188,7 @@
AllOf(DeclNamed("foo"), WithTemplateArgs("")),
AllOf(DeclNamed("i"), WithTemplateArgs("")),
AllOf(DeclNamed("d"), WithTemplateArgs("")),
- AllOf(DeclNamed("foo"), WithTemplateArgs("<>")),
+ AllOf(DeclNamed("foo"), WithTemplateArgs("<T *>")),
AllOf(DeclNamed("foo"), WithTemplateArgs("<bool>"))}));
}
Index: clang-tools-extra/trunk/clangd/unittests/PrintASTTests.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/unittests/PrintASTTests.cpp
+++ clang-tools-extra/trunk/clangd/unittests/PrintASTTests.cpp
@@ -95,6 +95,15 @@
struct Bar { friend class Foo<int>; };
template <> struct ^Foo<int> {};)cpp",
{"<int>"}},
+ {
+ R"cpp(
+ template<class T>
+ T S = T(10);
+ template <class T>
+ int ^S<T*> = 0;
+ template <>
+ int ^S<double> = 0;)cpp",
+ {"<T *>", "<double>"}},
})),);
} // namespace
} // namespace clangd
Index: clang-tools-extra/trunk/clangd/AST.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/AST.cpp
+++ clang-tools-extra/trunk/clangd/AST.cpp
@@ -36,6 +36,10 @@
llvm::dyn_cast<ClassTemplatePartialSpecializationDecl>(&ND)) {
if (auto *Args = Cls->getTemplateArgsAsWritten())
return Args->arguments();
+ } else if (auto *Var =
+ llvm::dyn_cast<VarTemplatePartialSpecializationDecl>(&ND)) {
+ if (auto *Args = Var->getTemplateArgsAsWritten())
+ return Args->arguments();
} else if (auto *Var = llvm::dyn_cast<VarTemplateSpecializationDecl>(&ND))
return Var->getTemplateArgsInfo().arguments();
// We return None for ClassTemplateSpecializationDecls because it does not
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65926.214323.patch
Type: text/x-patch
Size: 2509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190809/23c90c61/attachment-0001.bin>
More information about the cfe-commits
mailing list