DIAG(err_typecheck_call_not_function, ERROR,
"called object type '%0' is not a function or function pointer")
DIAG(err_typecheck_call_too_few_args, ERROR,
- "too few arguments to function")
-DIAG(err_typecheck_block_too_few_args, ERROR,
- "too few arguments to block")
+ "too few arguments to %select{function|block|method}0 call")
DIAG(err_typecheck_call_too_many_args, ERROR,
- "too many arguments to function")
-DIAG(err_typecheck_block_too_many_args, ERROR,
- "too many arguments to block call")
+ "too many arguments to %select{function|block|method}0 call")
DIAG(err_typecheck_closure_too_many_args, ERROR,
"too many arguments to closure call")
DIAG(err_typecheck_call_invalid_ordered_compare, ERROR,
bool Sema::SemaBuiltinVAStart(CallExpr *TheCall) {
Expr *Fn = TheCall->getCallee();
if (TheCall->getNumArgs() > 2) {
- Diag(TheCall->getArg(2)->getLocStart(),
+ Diag(TheCall->getArg(2)->getLocStart(),
diag::err_typecheck_call_too_many_args)
- << Fn->getSourceRange()
+ << 0 /*function call*/ << Fn->getSourceRange()
<< SourceRange(TheCall->getArg(2)->getLocStart(),
(*(TheCall->arg_end()-1))->getLocEnd());
return true;
/// friends. This is declared to take (...), so we have to check everything.
bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) {
if (TheCall->getNumArgs() < 2)
- return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args);
+ return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
+ << 0 /*function call*/;
if (TheCall->getNumArgs() > 2)
return Diag(TheCall->getArg(2)->getLocStart(),
diag::err_typecheck_call_too_many_args)
+ << 0 /*function call*/
<< SourceRange(TheCall->getArg(2)->getLocStart(),
(*(TheCall->arg_end()-1))->getLocEnd());
Action::ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
if (TheCall->getNumArgs() < 3)
return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
- << TheCall->getSourceRange();
+ << 0 /*function call*/ << TheCall->getSourceRange();
QualType FAType = TheCall->getArg(0)->getType();
QualType SAType = TheCall->getArg(1)->getType();
if (TheCall->getNumArgs() != numElements+2) {
if (TheCall->getNumArgs() < numElements+2)
return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
- << TheCall->getSourceRange();
+ << 0 /*function call*/ << TheCall->getSourceRange();
return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_many_args)
- << TheCall->getSourceRange();
+ << 0 /*function call*/ << TheCall->getSourceRange();
}
for (unsigned i = 2; i < TheCall->getNumArgs(); i++) {
if (NumArgs > 3)
return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_many_args)
- << TheCall->getSourceRange();
+ << 0 /*function call*/ << TheCall->getSourceRange();
// Argument 0 is checked for us and the remaining arguments must be
// constant integers.
// If too few arguments are available (and we don't have default
// arguments for the remaining parameters), don't make the call.
if (NumArgs < NumArgsInProto) {
- if (FDecl && NumArgs >= FDecl->getMinRequiredArguments()) {
- // Use default arguments for missing arguments
- NumArgsToCheck = NumArgsInProto;
- TheCall->setNumArgs(NumArgsInProto);
- } else
- return Diag(RParenLoc,
- !Fn->getType()->isBlockPointerType()
- ? diag::err_typecheck_call_too_few_args
- : diag::err_typecheck_block_too_few_args)
- << Fn->getSourceRange();
+ if (!FDecl || NumArgs < FDecl->getMinRequiredArguments())
+ return Diag(RParenLoc, diag::err_typecheck_call_too_few_args)
+ << Fn->getType()->isBlockPointerType() << Fn->getSourceRange();
+ // Use default arguments for missing arguments
+ NumArgsToCheck = NumArgsInProto;
+ TheCall->setNumArgs(NumArgsInProto);
}
// If too many are passed and not variadic, error on the extras and drop
// them.
if (NumArgs > NumArgsInProto) {
if (!Proto->isVariadic()) {
- Diag(Args[NumArgsInProto]->getLocStart(),
- !Fn->getType()->isBlockPointerType()
- ? diag::err_typecheck_call_too_many_args
- : diag::err_typecheck_block_too_many_args)
- << Fn->getSourceRange()
+ Diag(Args[NumArgsInProto]->getLocStart(),
+ diag::err_typecheck_call_too_many_args)
+ << Fn->getType()->isBlockPointerType() << Fn->getSourceRange()
<< SourceRange(Args[NumArgsInProto]->getLocStart(),
Args[NumArgs-1]->getLocEnd());
// This deletes the extra arguments.
if (NumArgs != NumNamedArgs) {
Diag(Args[NumNamedArgs]->getLocStart(),
diag::err_typecheck_call_too_many_args)
- << Method->getSourceRange()
+ << 2 /*method*/ << Method->getSourceRange()
<< SourceRange(Args[NumNamedArgs]->getLocStart(),
Args[NumArgs-1]->getLocEnd());
}
CFSTR("\242"); // expected-warning {{ CFString literal contains non-ASCII character }}
CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }}
CFSTR(242); // expected-error {{ CFString literal is not a string constant }} expected-warning {{incompatible integer to pointer conversion}}
- CFSTR("foo", "bar"); // expected-error {{ error: too many arguments to function }}
+ CFSTR("foo", "bar"); // expected-error {{too many arguments to function call}}
}
@end
int f0(I0 *ob) {
- [ ob nonVararg: 0, 1, 2]; // expected-error {{too many arguments to function}}
+ [ ob nonVararg: 0, 1, 2]; // expected-error {{too many arguments to method call}}
}