Tokenizer: Add 'BOOST_FOREACH' pattern where it was missing.
This commit is contained in:
parent
ca8e8d26c7
commit
6314d04a04
|
@ -1957,7 +1957,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
|
|
||||||
// if MACRO
|
// if MACRO
|
||||||
for (const Token *tok = _tokens; tok; tok = tok->next()) {
|
for (const Token *tok = _tokens; tok; tok = tok->next()) {
|
||||||
if (Token::Match(tok, "if|for|while %var% (")) {
|
if (Token::Match(tok, "if|for|while|BOOST_FOREACH %var% (")) {
|
||||||
syntaxError(tok);
|
syntaxError(tok);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -6278,7 +6278,7 @@ bool Tokenizer::simplifyKnownVariablesSimplify(Token **tok2, Token *tok3, unsign
|
||||||
// then it can't be changed by the function call.
|
// then it can't be changed by the function call.
|
||||||
if (tok3->str() == ")" && tok3->link() &&
|
if (tok3->str() == ")" && tok3->link() &&
|
||||||
Token::Match(tok3->link()->tokAt(-2), "[;{}] %var% (") &&
|
Token::Match(tok3->link()->tokAt(-2), "[;{}] %var% (") &&
|
||||||
!Token::Match(tok3->link()->previous(), "if|for|while|switch"))
|
!Token::Match(tok3->link()->previous(), "if|for|while|switch|BOOST_FOREACH"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Stop if something like 'while (--var)' is found
|
// Stop if something like 'while (--var)' is found
|
||||||
|
@ -7057,7 +7057,7 @@ bool Tokenizer::duplicateDefinition(Token ** tokPtr, const Token * name)
|
||||||
if (end) {
|
if (end) {
|
||||||
if (Token::simpleMatch(end, ") {")) { // function parameter ?
|
if (Token::simpleMatch(end, ") {")) { // function parameter ?
|
||||||
// make sure it's not a conditional
|
// make sure it's not a conditional
|
||||||
if (Token::Match(end->link()->previous(), "if|for|while|switch"))
|
if (Token::Match(end->link()->previous(), "if|for|while|switch|BOOST_FOREACH"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// look backwards
|
// look backwards
|
||||||
|
|
Loading…
Reference in New Issue