C++: Improve calculation of function argument count.

Reuse Function::argumentCount instead of reimplementing it.

Change-Id: I05ba2dbee087e5dfd53c7af3ec94d214f6e37a54
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-10-21 13:27:35 +02:00
committed by Leandro T. C. Melo
parent dc23698e3a
commit f746c746ea

View File

@@ -378,9 +378,9 @@ void FunctionDeclDefLink::showMarker(CPPEditorWidget *editor)
// does consider foo(void) to have one argument
static int declaredArgumentCount(Function *function)
{
int c = function->memberCount();
if (c > 0 && function->memberAt(c - 1)->isBlock())
return c - 1;
int c = function->argumentCount();
if (c == 0 && function->memberCount() > 0 && function->memberAt(0)->type().type()->isVoidType())
return 1;
return c;
}