Merge branch 'master' of http://github.com/danmar/cppcheck
This commit is contained in:
commit
15e81e60a4
|
@ -281,6 +281,8 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
||||||
// has body?
|
// has body?
|
||||||
if (Token::Match(argStart->link(), ") const| {|:"))
|
if (Token::Match(argStart->link(), ") const| {|:"))
|
||||||
{
|
{
|
||||||
|
Scope *old_scope = scope;
|
||||||
|
|
||||||
// class function
|
// class function
|
||||||
if (tok->previous() && tok->previous()->str() == "::")
|
if (tok->previous() && tok->previous()->str() == "::")
|
||||||
addFunction(&scope, &tok, argStart);
|
addFunction(&scope, &tok, argStart);
|
||||||
|
@ -310,21 +312,19 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
||||||
function.arg = function.argDef;
|
function.arg = function.argDef;
|
||||||
function.type = Function::eFunction;
|
function.type = Function::eFunction;
|
||||||
|
|
||||||
Scope *old_scope = scope;
|
|
||||||
|
|
||||||
addNewFunction(&scope, &tok);
|
addNewFunction(&scope, &tok);
|
||||||
|
|
||||||
if (scope)
|
if (scope)
|
||||||
old_scope->functionList.push_back(function);
|
old_scope->functionList.push_back(function);
|
||||||
|
}
|
||||||
|
|
||||||
// syntax error
|
// syntax error
|
||||||
else
|
if (!scope)
|
||||||
{
|
{
|
||||||
scope = old_scope;
|
scope = old_scope;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// function returning function pointer with body
|
// function returning function pointer with body
|
||||||
else if (Token::simpleMatch(argStart->link(), ") ) (") &&
|
else if (Token::simpleMatch(argStart->link(), ") ) (") &&
|
||||||
|
@ -339,11 +339,37 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
||||||
|
|
||||||
// regular function
|
// regular function
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
Function function;
|
||||||
|
|
||||||
|
// save the function definition argument start '('
|
||||||
|
function.argDef = argStart;
|
||||||
|
|
||||||
|
// save the access type
|
||||||
|
function.access = Public;
|
||||||
|
|
||||||
|
// save the function name location
|
||||||
|
function.tokenDef = funcStart;
|
||||||
|
function.token = funcStart;
|
||||||
|
|
||||||
|
function.isInline = false;
|
||||||
|
function.hasBody = true;
|
||||||
|
function.arg = function.argDef;
|
||||||
|
function.type = Function::eFunction;
|
||||||
|
function.retFuncPtr = true;
|
||||||
|
|
||||||
addNewFunction(&scope, &tok1);
|
addNewFunction(&scope, &tok1);
|
||||||
|
|
||||||
|
if (scope)
|
||||||
|
old_scope->functionList.push_back(function);
|
||||||
|
}
|
||||||
|
|
||||||
// syntax error?
|
// syntax error?
|
||||||
if (!scope)
|
if (!scope)
|
||||||
|
{
|
||||||
scope = old_scope;
|
scope = old_scope;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
tok = tok1;
|
tok = tok1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue