mirror of https://github.com/microsoft/clang.git
-Wdocumentation should allow '...' params in variadic function type aliases
rdar://34811344 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315103 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f1381a926e
commit
c1458454c9
|
@ -813,7 +813,7 @@ bool Sema::isAnyFunctionDecl() {
|
|||
}
|
||||
|
||||
bool Sema::isFunctionOrMethodVariadic() {
|
||||
if (!isAnyFunctionDecl() && !isObjCMethodDecl() && !isFunctionTemplateDecl())
|
||||
if (!isFunctionDecl() || !ThisDeclInfo->CurrentDecl)
|
||||
return false;
|
||||
if (const FunctionDecl *FD =
|
||||
dyn_cast<FunctionDecl>(ThisDeclInfo->CurrentDecl))
|
||||
|
@ -824,6 +824,14 @@ bool Sema::isFunctionOrMethodVariadic() {
|
|||
if (const ObjCMethodDecl *MD =
|
||||
dyn_cast<ObjCMethodDecl>(ThisDeclInfo->CurrentDecl))
|
||||
return MD->isVariadic();
|
||||
if (const TypedefNameDecl *TD =
|
||||
dyn_cast<TypedefNameDecl>(ThisDeclInfo->CurrentDecl)) {
|
||||
QualType Type = TD->getUnderlyingType();
|
||||
if (Type->isFunctionPointerType() || Type->isBlockPointerType())
|
||||
Type = Type->getPointeeType();
|
||||
if (const auto *FT = Type->getAs<FunctionProtoType>())
|
||||
return FT->isVariadic();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1282,3 +1282,25 @@ struct HasMoreFields {
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* Function pointer typedef with variadic params.
|
||||
*
|
||||
* @param a
|
||||
* works
|
||||
*
|
||||
* @param ...
|
||||
* now should work too.
|
||||
*/
|
||||
typedef void (*VariadicFnType)(int a, ...);
|
||||
|
||||
/*!
|
||||
* Function pointer type alias with variadic params.
|
||||
*
|
||||
* @param a
|
||||
* works
|
||||
*
|
||||
* @param ...
|
||||
* now should work too.
|
||||
*/
|
||||
using VariadicFnType2 = void (*)(int a, ...);
|
||||
|
|
|
@ -299,3 +299,14 @@ void (^_Nullable blockPointerVariableThatLeadsNowhere)();
|
|||
@property void (^blockReturnsNothing)();
|
||||
|
||||
@end
|
||||
|
||||
/*!
|
||||
* Block typedef with variadic params.
|
||||
*
|
||||
* @param a
|
||||
* works
|
||||
*
|
||||
* @param ...
|
||||
* now should work too.
|
||||
*/
|
||||
typedef void (^VariadicBlockType)(int a, ...);
|
||||
|
|
Loading…
Reference in New Issue