diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index cb6cb6435..3d6972aa5 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -650,7 +650,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti for (func = scope->functionList.begin(); func != scope->functionList.end(); ++func) { // add arguments - func->addArguments(this, scope); + func->addArguments(this, &*func, scope); } } @@ -1234,7 +1234,7 @@ unsigned int Function::initializedArgCount() const return count; } -void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *scope) +void Function::addArguments(const SymbolDatabase *symbolDatabase, const Function *func, const Scope *scope) { // check for non-empty argument list "( ... )" if (arg->link() != arg->next() && !Token::simpleMatch(arg, "( void )")) @@ -1279,7 +1279,8 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s nameTok = tok->previous(); endTok = nameTok->previous(); - symbolDatabase->debugMessage(nameTok, "Function::addArguments found argument \'" + nameTok->str() + "\' with varid 0."); + if (func->hasBody) + symbolDatabase->debugMessage(nameTok, "Function::addArguments found argument \'" + nameTok->str() + "\' with varid 0."); } else endTok = startTok; diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 63717a5f2..ef4cc19ae 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -353,7 +353,7 @@ public: return argumentList.size(); } unsigned int initializedArgCount() const; - void addArguments(const SymbolDatabase *symbolDatabase, const Scope *scope); + void addArguments(const SymbolDatabase *symbolDatabase, const Function *func, const Scope *scope); const Token *tokenDef; // function name token in class definition const Token *argDef; // function argument start '(' in class definition