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; const Token *ftok;
// Look at function call, what parameter number is it? // Look at function call, what parameter number is it?
unsigned int parentheses = 1;
unsigned int parameter = 1; unsigned int parameter = 1;
for (ftok = fpar->previous(); ftok; ftok = ftok->previous()) { for (ftok = fpar->previous(); ftok; ftok = ftok->previous()) {
if (ftok->str() == "(") { if (ftok->str() == "(")
--parentheses; break;
if (parentheses == 0) { else if (ftok->str() == ")")
break; ftok = ftok->link();
} else if (ftok->str() == ",")
} else if (ftok->str() == ")") { ++parameter;
++parentheses; else if (Token::Match(ftok, "[;{}]"))
} else if (parentheses == 1 && ftok->str() == ",") {
++parameter;
} else if (Token::Match(ftok, "[;{}]")) {
break; break;
}
} }
// Is this a function call? // Is this a function call?