r184283 - Revert r184249, "doc. parsing: Allow parameter name "..." for variadic functions/methods."
NAKAMURA Takumi
geek4civic at gmail.com
Tue Jun 18 23:58:14 PDT 2013
Author: chapuni
Date: Wed Jun 19 01:58:14 2013
New Revision: 184283
URL: http://llvm.org/viewvc/llvm-project?rev=184283&view=rev
Log:
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, ...);
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=184283&r1=184282&r2=184283&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CommentSema.h (original)
+++ cfe/trunk/include/clang/AST/CommentSema.h Wed Jun 19 01:58:14 2013
@@ -220,7 +220,6 @@ 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=184283&r1=184282&r2=184283&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentSema.cpp (original)
+++ cfe/trunk/lib/AST/CommentSema.cpp Wed Jun 19 01:58:14 2013
@@ -720,7 +720,7 @@ void Sema::resolveParamCommandIndexes(co
SmallVector<ParamCommandComment *, 8> ParamVarDocs;
ArrayRef<const ParmVarDecl *> 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<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.
@@ -918,8 +906,6 @@ 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=184283&r1=184282&r2=184283&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation.m (original)
+++ cfe/trunk/test/Sema/warn-documentation.m Wed Jun 19 01:58:14 2013
@@ -215,22 +215,3 @@ int FooBar();
/// \brief comment
-(void)meth {}
@end
-
-// rdar://14124644
- at interface rdar14124644
-/// @param[in] arg somthing
-/// @param[in] ... This is vararg
-- (void) VarArgMeth : (id)arg, ...;
- at end
-
- at implementation rdar14124644
-/// @param[in] arg somthing
-/// @param[in] ... This is vararg
-- (void) VarArgMeth : (id)arg, ... {}
- at 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, ...);
More information about the cfe-commits
mailing list