Comment parsing: recognize \param ... on function templates with variadic

parameters

Patch by Joe Ranieri.

llvm-svn: 204235
This commit is contained in:
Dmitri Gribenko 2014-03-19 13:59:36 +00:00
parent 17703c1092
commit d9eb05aca3
2 changed files with 24 additions and 1 deletions

View File

@ -792,11 +792,14 @@ bool Sema::isAnyFunctionDecl() {
}
bool Sema::isFunctionOrMethodVariadic() {
if (!isAnyFunctionDecl() && !isObjCMethodDecl())
if (!isAnyFunctionDecl() && !isObjCMethodDecl() && !isFunctionTemplateDecl())
return false;
if (const FunctionDecl *FD =
dyn_cast<FunctionDecl>(ThisDeclInfo->CurrentDecl))
return FD->isVariadic();
if (const FunctionTemplateDecl *FTD =
dyn_cast<FunctionTemplateDecl>(ThisDeclInfo->CurrentDecl))
return FTD->getTemplatedDecl()->isVariadic();
if (const ObjCMethodDecl *MD =
dyn_cast<ObjCMethodDecl>(ThisDeclInfo->CurrentDecl))
return MD->isVariadic();

View File

@ -371,6 +371,26 @@ int test_vararg_param3(int aaa);
int test_vararg_param4();
/// \param aaa Aaa
/// \param ... Vararg
template<typename T>
int test_template_vararg_param1(int aaa, ...);
/// \param ... Vararg
template<typename T>
int test_template_vararg_param2(...);
// expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
/// \param ... Vararg
template<typename T>
int test_template_vararg_param3(int aaa);
// expected-warning@+1 {{parameter '...' not found in the function declaration}}
/// \param ... Vararg
template<typename T>
int test_template_vararg_param4();
// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
/// \tparam T Aaa
int test_tparam1;