diff options
author | Aaron Puchert <aaron.puchert@sap.com> | 2021-11-12 21:09:16 +0100 |
---|---|---|
committer | Aaron Puchert <aaron.puchert@sap.com> | 2021-11-12 21:10:56 +0100 |
commit | 4e7df1ef7b679953c1501177539166876c4cbda4 (patch) | |
tree | 8c5111141735a0714a6b6e5da26fd7273b5a48b4 /clang/lib/AST/Comment.cpp | |
parent | 5074a20dec70ef2afef650f770fb45eb0247a4f7 (diff) | |
download | llvm-4e7df1ef7b679953c1501177539166876c4cbda4.zip llvm-4e7df1ef7b679953c1501177539166876c4cbda4.tar.gz llvm-4e7df1ef7b679953c1501177539166876c4cbda4.tar.bz2 |
Comment AST: Find out if function is variadic in DeclInfo::fill
Then we don't have to look into the declaration again. Also it's only
natural to collect this information alongside parameters and return
type, as it's also just a parameter in some sense.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D113690
Diffstat (limited to 'clang/lib/AST/Comment.cpp')
-rw-r--r-- | clang/lib/AST/Comment.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp index 5e6a7de..aac0591 100644 --- a/clang/lib/AST/Comment.cpp +++ b/clang/lib/AST/Comment.cpp @@ -210,6 +210,7 @@ void DeclInfo::fill() { IsObjCMethod = false; IsInstanceMethod = false; IsClassMethod = false; + IsVariadic = false; ParamVars = None; TemplateParameters = nullptr; @@ -248,6 +249,7 @@ void DeclInfo::fill() { IsInstanceMethod = MD->isInstance(); IsClassMethod = !IsInstanceMethod; } + IsVariadic = FD->isVariadic(); break; } case Decl::ObjCMethod: { @@ -258,6 +260,7 @@ void DeclInfo::fill() { IsObjCMethod = true; IsInstanceMethod = MD->isInstanceMethod(); IsClassMethod = !IsInstanceMethod; + IsVariadic = MD->isVariadic(); break; } case Decl::FunctionTemplate: { @@ -268,6 +271,7 @@ void DeclInfo::fill() { ParamVars = FD->parameters(); ReturnType = FD->getReturnType(); TemplateParameters = FTD->getTemplateParameters(); + IsVariadic = FD->isVariadic(); break; } case Decl::ClassTemplate: { @@ -351,6 +355,8 @@ void DeclInfo::fill() { Kind = FunctionKind; ParamVars = FTL.getParams(); ReturnType = FTL.getReturnLoc().getType(); + if (const auto *FPT = dyn_cast<FunctionProtoType>(FTL.getTypePtr())) + IsVariadic = FPT->isVariadic(); } } |