[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
Thu Aug 8 06:21:02 PDT 2019
jvikstrom updated this revision to Diff 214132.
jvikstrom marked 2 inline comments as done.
jvikstrom added a comment.
Merged test with PrintASTTest.cpp.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65926/new/
https://reviews.llvm.org/D65926
Files:
clang-tools-extra/clangd/AST.cpp
clang-tools-extra/clangd/unittests/ClangdUnitTests.cpp
clang-tools-extra/clangd/unittests/PrintASTTests.cpp
Index: clang-tools-extra/clangd/unittests/PrintASTTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/PrintASTTests.cpp
+++ clang-tools-extra/clangd/unittests/PrintASTTests.cpp
@@ -96,6 +96,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/clangd/unittests/ClangdUnitTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/ClangdUnitTests.cpp
+++ clang-tools-extra/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/clangd/AST.cpp
===================================================================
--- clang-tools-extra/clangd/AST.cpp
+++ clang-tools-extra/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.214132.patch
Type: text/x-patch
Size: 2455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190808/eb63e564/attachment.bin>
More information about the cfe-commits
mailing list