Fariborz, I had to revert it in r184283. It crashes in a simple case, with "..." without any params. /// The description without "param"s. int printf(const char *format, ...);
In a practical case, it crashed in llvm::StructType::get(Type *elt1, ...), llvm/IR/DerivedTypes.h. 2013/6/19 Fariborz Jahanian <[email protected]>: > Author: fjahanian > Date: Tue Jun 18 17:40:39 2013 > New Revision: 184249 > > URL: http://llvm.org/viewvc/llvm-project?rev=184249&view=rev > Log: > doc. parsing: Allow parameter name "..." for variadic functions/methods. > // rdar://14124644 > > Modified: > cfe/trunk/include/clang/AST/CommentSema.h > cfe/trunk/lib/AST/CommentSema.cpp > cfe/trunk/test/Sema/warn-documentation.m > > Modified: cfe/trunk/include/clang/AST/CommentSema.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentSema.h?rev=184249&r1=184248&r2=184249&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/CommentSema.h (original) > +++ cfe/trunk/include/clang/AST/CommentSema.h Tue Jun 18 17:40:39 2013 > @@ -220,6 +220,7 @@ public: > bool isUnionDecl(); > bool isObjCInterfaceDecl(); > bool isObjCProtocolDecl(); > + bool isFunctionOrMethodVariadic(); > > ArrayRef<const ParmVarDecl *> getParamVars(); > > > Modified: cfe/trunk/lib/AST/CommentSema.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentSema.cpp?rev=184249&r1=184248&r2=184249&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/CommentSema.cpp (original) > +++ cfe/trunk/lib/AST/CommentSema.cpp Tue Jun 18 17:40:39 2013 > @@ -720,7 +720,7 @@ void Sema::resolveParamCommandIndexes(co > SmallVector<ParamCommandComment *, 8> ParamVarDocs; > > ArrayRef<const ParmVarDecl *> ParamVars = getParamVars(); > - ParamVarDocs.resize(ParamVars.size(), NULL); > + ParamVarDocs.resize(ParamVars.size() + isFunctionOrMethodVariadic(), NULL); > > // First pass over all \\param commands: resolve all parameter names. > for (Comment::child_iterator I = FC->child_begin(), E = FC->child_end(); > @@ -808,6 +808,18 @@ bool Sema::isObjCMethodDecl() { > return isFunctionDecl() && ThisDeclInfo->CurrentDecl && > isa<ObjCMethodDecl>(ThisDeclInfo->CurrentDecl); > } > + > +bool Sema::isFunctionOrMethodVariadic() { > + if (!isAnyFunctionDecl() && !isObjCMethodDecl()) > + return false; > + if (const FunctionDecl *FD = > + dyn_cast<FunctionDecl>(ThisDeclInfo->CurrentDecl)) > + return FD->isVariadic(); > + if (const ObjCMethodDecl *MD = > + dyn_cast<ObjCMethodDecl>(ThisDeclInfo->CurrentDecl)) > + return MD->isVariadic(); > + return false; > +} > > /// isFunctionPointerVarDecl - returns 'true' if declaration is a pointer to > /// function decl. > @@ -906,6 +918,8 @@ unsigned Sema::resolveParmVarReference(S > if (II && II->getName() == Name) > return i; > } > + if (Name == "..." && isFunctionOrMethodVariadic()) > + return ParamVars.size(); > return ParamCommandComment::InvalidParamIndex; > } > > > Modified: cfe/trunk/test/Sema/warn-documentation.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.m?rev=184249&r1=184248&r2=184249&view=diff > ============================================================================== > --- cfe/trunk/test/Sema/warn-documentation.m (original) > +++ cfe/trunk/test/Sema/warn-documentation.m Tue Jun 18 17:40:39 2013 > @@ -215,3 +215,22 @@ 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, ...); > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
