aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/Comment.cpp
diff options
context:
space:
mode:
authorAaron Puchert <aaron.puchert@sap.com>2021-11-09 22:24:44 +0100
committerAaron Puchert <aaron.puchert@sap.com>2021-11-09 22:30:09 +0100
commit63ef0e17e28827eae53133b3467bdac7d9729318 (patch)
tree697bcdb6a684ad413b858b04ffcd094cae528fe5 /clang/lib/AST/Comment.cpp
parent4d6382430066465774f6f696ea3f4c402da1d705 (diff)
downloadllvm-63ef0e17e28827eae53133b3467bdac7d9729318.zip
llvm-63ef0e17e28827eae53133b3467bdac7d9729318.tar.gz
llvm-63ef0e17e28827eae53133b3467bdac7d9729318.tar.bz2
Comment AST: Add support for variable templates
We treat them as variables of course, though if they have function pointer type we treat them as functions, i.e. allow parameter and return value specifications. Just like VarDecls. Reviewed By: gribozavr2 Differential Revision: https://reviews.llvm.org/D111266
Diffstat (limited to 'clang/lib/AST/Comment.cpp')
-rw-r--r--clang/lib/AST/Comment.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp
index ce90abf5..5e6a7de 100644
--- a/clang/lib/AST/Comment.cpp
+++ b/clang/lib/AST/Comment.cpp
@@ -294,6 +294,12 @@ void DeclInfo::fill() {
Kind = ClassKind;
break;
case Decl::Var:
+ if (const VarTemplateDecl *VTD =
+ cast<VarDecl>(CommentDecl)->getDescribedVarTemplate()) {
+ TemplateKind = TemplateSpecialization;
+ TemplateParameters = VTD->getTemplateParameters();
+ }
+ LLVM_FALLTHROUGH;
case Decl::Field:
case Decl::EnumConstant:
case Decl::ObjCIvar:
@@ -305,6 +311,15 @@ void DeclInfo::fill() {
TSI = PD->getTypeSourceInfo();
Kind = VariableKind;
break;
+ case Decl::VarTemplate: {
+ const VarTemplateDecl *VTD = cast<VarTemplateDecl>(CommentDecl);
+ Kind = VariableKind;
+ TemplateKind = Template;
+ TemplateParameters = VTD->getTemplateParameters();
+ if (const VarDecl *VD = VTD->getTemplatedDecl())
+ TSI = VD->getTypeSourceInfo();
+ break;
+ }
case Decl::Namespace:
Kind = NamespaceKind;
break;