Optimization: Skip over expression in brackets in Tokenizer::isFunctionParameterPassedByValue()

This commit is contained in:
PKEuS 2015-12-10 15:53:14 +01:00
parent 37572dc109
commit 51bb76c5b5
1 changed files with 7 additions and 12 deletions

View File

@ -7954,21 +7954,16 @@ bool Tokenizer::isFunctionParameterPassedByValue(const Token *fpar) const
const Token *ftok;
// Look at function call, what parameter number is it?
unsigned int parentheses = 1;
unsigned int parameter = 1;
for (ftok = fpar->previous(); ftok; ftok = ftok->previous()) {
if (ftok->str() == "(") {
--parentheses;
if (parentheses == 0) {
break;
}
} else if (ftok->str() == ")") {
++parentheses;
} else if (parentheses == 1 && ftok->str() == ",") {
++parameter;
} else if (Token::Match(ftok, "[;{}]")) {
if (ftok->str() == "(")
break;
else if (ftok->str() == ")")
ftok = ftok->link();
else if (ftok->str() == ",")
++parameter;
else if (Token::Match(ftok, "[;{}]"))
break;
}
}
// Is this a function call?