This commit is contained in:
Sébastien Debrard 2011-01-22 10:49:26 +01:00
commit 53c36f53ef
3 changed files with 11 additions and 7 deletions

View File

@ -842,6 +842,12 @@ void SymbolDatabase::addNewFunction(Scope **scope, const Token **tok)
*tok = tok1;
}
else
{
delete new_scope;
*scope = NULL;
*tok = NULL;
}
}
const Token *SymbolDatabase::initBaseInfo(Scope *scope, const Token *tok)

View File

@ -3303,7 +3303,7 @@ void Tokenizer::setVarId()
// If pattern is "( %type% *|& %var% )" then check if it's a
// variable declaration or a multiplication / mask
if (Token::Match(tok, "( %type% *|& %var% )") && !tok->next()->isStandardType())
if (Token::Match(tok, "( %type% *|& %var% [),]") && !tok->next()->isStandardType())
{
if (!Token::Match(tok->previous(), "%type%"))
continue;
@ -7950,7 +7950,6 @@ void Tokenizer::simplifyStd()
const Token *Tokenizer::getFunctionTokenByName(const char funcname[]) const
{
if (_symbolDatabase == NULL)
getSymbolDatabase();
std::list<Scope *>::const_iterator i;
@ -7971,7 +7970,7 @@ const Token *Tokenizer::getFunctionTokenByName(const char funcname[]) const
void Tokenizer::fillFunctionList()
{
_symbolDatabase = new SymbolDatabase(this, _settings, _errorLogger);
getSymbolDatabase();
}
//---------------------------------------------------------------------------

View File

@ -2722,6 +2722,7 @@ private:
void varidFunctionCall2()
{
// #2491
const std::string code("void f(int b) {\n"
" x(a*b,10);\n"
"}");
@ -2730,8 +2731,7 @@ private:
"2: x ( a * b");
const std::string expected2(" , 10 ) ;\n"
"3: }\n");
TODO_ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code));
ASSERT_EQUALS(expected1+"@2"+expected2, tokenizeDebugListing(code));
ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code));
}
void varidFunctionCall3()
@ -2751,7 +2751,6 @@ private:
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
}
void varidStl()
{
const std::string actual = tokenizeDebugListing(