// xx.m:13: note: if this code is reached, the program will abort
cast = new CastExpr(Context->getPointerType(Context->VoidTy), DRE,
SourceLocation());
-
+
// Now do the "normal" pointer to function cast.
QualType castType = Context->getFunctionType(returnType,
&ArgTypes[0], ArgTypes.size(),
- false/*FIXME:variadic*/);
+ Exp->getMethodDecl()->isVariadic());
castType = Context->getPointerType(castType);
cast = new CastExpr(castType, cast, SourceLocation());
// We have a selector or a colon, continue parsing.
}
+ bool isVariadic = false;
+
// Parse the (optional) parameter list.
while (Tok.is(tok::comma)) {
ConsumeToken();
if (Tok.is(tok::ellipsis)) {
+ isVariadic = true;
ConsumeToken();
break;
}
+ // FIXME: implement this...
// Parse the c-style argument declaration-specifier.
DeclSpec DS;
ParseDeclarationSpecifiers(DS);
return Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(),
mType, IDecl, DSRet, ReturnType, Sel,
&ArgTypeQuals[0], &KeyTypes[0],
- &ArgNames[0],
- MethodAttrs, MethodImplKind);
+ &ArgNames[0], MethodAttrs,
+ MethodImplKind, isVariadic);
}
/// CmpProtocolVals - Comparison predicate for sorting protocols.
// optional arguments. The number of types/arguments is obtained
// from the Sel.getNumArgs().
ObjcDeclSpec *ArgQT, TypeTy **ArgTypes, IdentifierInfo **ArgNames,
- AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind);
+ AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind,
+ bool isVariadic = false);
// ActOnClassMessage - used for both unary and keyword messages.
// ArgExprs is optional - if it is present, the number of expressions
// optional arguments. The number of types/arguments is obtained
// from the Sel.getNumArgs().
ObjcDeclSpec *ArgQT, TypeTy **ArgTypes, IdentifierInfo **ArgNames,
- AttributeList *AttrList, tok::ObjCKeywordKind MethodDeclKind) {
+ AttributeList *AttrList, tok::ObjCKeywordKind MethodDeclKind,
+ bool isVariadic) {
llvm::SmallVector<ParmVarDecl*, 16> Params;
for (unsigned i = 0; i < Sel.getNumArgs(); i++) {
resultDeclType,
CDecl,
0, -1, AttrList,
- MethodType == tok::minus,
+ MethodType == tok::minus, isVariadic,
MethodDeclKind == tok::objc_optional ?
ObjcMethodDecl::Optional :
ObjcMethodDecl::Required);
/// declared in class Decl.
/// instance (true) or class (false) method.
bool IsInstance : 1;
+ bool IsVariadic : 1;
+
/// @required/@optional
ImplementationControl DeclImplementation : 2;
Decl *contextDecl,
ParmVarDecl **paramInfo = 0, int numParams=-1,
AttributeList *M = 0, bool isInstance = true,
+ bool isVariadic = false,
ImplementationControl impControl = None,
Decl *PrevDecl = 0)
: Decl(ObjcMethod, beginLoc),
- IsInstance(isInstance), DeclImplementation(impControl),
- objcDeclQualifier(OBJC_TQ_None),
+ IsInstance(isInstance), IsVariadic(isVariadic),
+ DeclImplementation(impControl), objcDeclQualifier(OBJC_TQ_None),
MethodContext(static_cast<NamedDecl*>(contextDecl)),
SelName(SelInfo), MethodDeclType(T),
ParamInfo(paramInfo), NumMethodParams(numParams),
AttributeList *getMethodAttrs() const {return MethodAttrs;}
bool isInstance() const { return IsInstance; }
+ bool isVariadic() const { return IsVariadic; }
+
// Related to protocols declared in @protocol
void setDeclImplementation(ImplementationControl ic) {
DeclImplementation = ic;
IdentifierInfo **ArgNames, // non-zero when Sel.getNumArgs() > 0
AttributeList *AttrList, // optional
// tok::objc_not_keyword, tok::objc_optional, tok::objc_required
- tok::ObjCKeywordKind impKind) {
+ tok::ObjCKeywordKind impKind,
+ bool isVariadic = false) {
return 0;
}
// ActOnAtEnd - called to mark the @end. For declarations (interfaces,