From: NAKAMURA Takumi Date: Wed, 19 Jun 2013 06:58:14 +0000 (+0000) Subject: Revert r184249, "doc. parsing: Allow parameter name "..." for variadic functions... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0f9314bbe29d09c3ea3f76a257125d1568665c7;p=clang Revert r184249, "doc. parsing: Allow parameter name "..." for variadic functions/methods." It crashes in the case; /// Without any "param"s in the description. int printf(const char *format, ...); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184283 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/CommentSema.h b/include/clang/AST/CommentSema.h index 490b88c1bb..15e454dcc3 100644 --- a/include/clang/AST/CommentSema.h +++ b/include/clang/AST/CommentSema.h @@ -220,7 +220,6 @@ public: bool isUnionDecl(); bool isObjCInterfaceDecl(); bool isObjCProtocolDecl(); - bool isFunctionOrMethodVariadic(); ArrayRef getParamVars(); diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp index e6a5b85ed6..c242eb0f60 100644 --- a/lib/AST/CommentSema.cpp +++ b/lib/AST/CommentSema.cpp @@ -720,7 +720,7 @@ void Sema::resolveParamCommandIndexes(const FullComment *FC) { SmallVector ParamVarDocs; ArrayRef ParamVars = getParamVars(); - ParamVarDocs.resize(ParamVars.size() + isFunctionOrMethodVariadic(), NULL); + ParamVarDocs.resize(ParamVars.size(), NULL); // First pass over all \\param commands: resolve all parameter names. for (Comment::child_iterator I = FC->child_begin(), E = FC->child_end(); @@ -808,18 +808,6 @@ bool Sema::isObjCMethodDecl() { return isFunctionDecl() && ThisDeclInfo->CurrentDecl && isa(ThisDeclInfo->CurrentDecl); } - -bool Sema::isFunctionOrMethodVariadic() { - if (!isAnyFunctionDecl() && !isObjCMethodDecl()) - return false; - if (const FunctionDecl *FD = - dyn_cast(ThisDeclInfo->CurrentDecl)) - return FD->isVariadic(); - if (const ObjCMethodDecl *MD = - dyn_cast(ThisDeclInfo->CurrentDecl)) - return MD->isVariadic(); - return false; -} /// isFunctionPointerVarDecl - returns 'true' if declaration is a pointer to /// function decl. @@ -918,8 +906,6 @@ unsigned Sema::resolveParmVarReference(StringRef Name, if (II && II->getName() == Name) return i; } - if (Name == "..." && isFunctionOrMethodVariadic()) - return ParamVars.size(); return ParamCommandComment::InvalidParamIndex; } diff --git a/test/Sema/warn-documentation.m b/test/Sema/warn-documentation.m index e348dba3e0..17dd92e6eb 100644 --- a/test/Sema/warn-documentation.m +++ b/test/Sema/warn-documentation.m @@ -215,22 +215,3 @@ int FooBar(); /// \brief comment -(void)meth {} @end - -// rdar://14124644 -@interface rdar14124644 -/// @param[in] arg somthing -/// @param[in] ... This is vararg -- (void) VarArgMeth : (id)arg, ...; -@end - -@implementation rdar14124644 -/// @param[in] arg somthing -/// @param[in] ... This is vararg -- (void) VarArgMeth : (id)arg, ... {} -@end - -/// @param[in] format somthing -/// @param[in] ... -/// Variable arguments that are needed for the printf style -/// format string \a format. -int printf(const char* format, ...);