Function Call Rewriting

Hi again!

I want to catch the err_typecheck_call_too_few_args error (int the DiagnosticClient::HandleDiagnostic) and get the function call thats causes the error:

void func1(int a) {}

void func2()
{
func1(); //error here
}

I’ve no idea how to get the information that is the func1 call is causing the error.

Can someone help?

Thanks,
Makslane

the easiest way to find it is with grep:

$ cd llvm/tools/clang
$ grep err_typecheck_call_too_few_args lib//
lib/Sema/SemaChecking.cpp: return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
lib/Sema/SemaChecking.cpp: return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
lib/Sema/SemaChecking.cpp: return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
lib/Sema/SemaChecking.cpp: return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
lib/Sema/SemaChecking.cpp: diag::err_typecheck_call_too_few_args)
lib/Sema/SemaChecking.cpp: diag::err_typecheck_call_too_few_args)
lib/Sema/SemaExpr.cpp: return Diag(RParenLoc, diag::err_typecheck_call_too_few_args)

-Chris

Thanks Chris, but what I want is to use the clang to rewrite the function call, like this:

void func1(int a) {}

void func2()
{
func1(); //clang fires the error here
}

The code is rewrited to:

void func2()
{
func1(some int var);
}

What is your question?

I want to rewrite a function thats fire an the error err_typecheck_call_too_few_args.
Let me try a litle more…