From 461a67fa15370a9ec88f8f8a240bf7c123bb2029 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Dec 2017 20:11:37 +0000 Subject: Vendor import of clang trunk r321017: https://llvm.org/svn/llvm-project/cfe/trunk@321017 --- lib/AST/CommentSema.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/AST/CommentSema.cpp') diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp index 403454d3ab7e..6c2019e1a72b 100644 --- a/lib/AST/CommentSema.cpp +++ b/lib/AST/CommentSema.cpp @@ -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(ThisDeclInfo->CurrentDecl)) @@ -824,6 +824,14 @@ bool Sema::isFunctionOrMethodVariadic() { if (const ObjCMethodDecl *MD = dyn_cast(ThisDeclInfo->CurrentDecl)) return MD->isVariadic(); + if (const TypedefNameDecl *TD = + dyn_cast(ThisDeclInfo->CurrentDecl)) { + QualType Type = TD->getUnderlyingType(); + if (Type->isFunctionPointerType() || Type->isBlockPointerType()) + Type = Type->getPointeeType(); + if (const auto *FT = Type->getAs()) + return FT->isVariadic(); + } return false; } -- cgit v1.3