Optimization Tokenizer::simplifyMathFunctions. Make an a priori check whether the token combination can be a function call at all.
This commit is contained in:
parent
b13e3ac549
commit
6e9e20d5b1
|
@ -8241,6 +8241,8 @@ bool Tokenizer::simplifyMathFunctions()
|
||||||
{
|
{
|
||||||
bool simplifcationMade = false;
|
bool simplifcationMade = false;
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
|
const Token * tokNext = tok->next();
|
||||||
|
if (tokNext && tokNext->str() == "(") { // precondition for function
|
||||||
if (Token::Match(tok, "atol ( %str% )")) { //@todo Add support for atoll()
|
if (Token::Match(tok, "atol ( %str% )")) { //@todo Add support for atoll()
|
||||||
if (tok->previous() &&
|
if (tok->previous() &&
|
||||||
Token::simpleMatch(tok->tokAt(-2), "std ::")) {
|
Token::simpleMatch(tok->tokAt(-2), "std ::")) {
|
||||||
|
@ -8489,6 +8491,7 @@ bool Tokenizer::simplifyMathFunctions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// returns true if a simplifcation was performed and false otherwise.
|
// returns true if a simplifcation was performed and false otherwise.
|
||||||
return simplifcationMade;
|
return simplifcationMade;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue