Fixed #558 (Tokenizer: Bad simplification of 'for(unsigned i = 0; i < 100; ++i)')
This commit is contained in:
parent
1c59e4a51b
commit
e1beb70f80
|
@ -2442,10 +2442,10 @@ void Tokenizer::unsignedint()
|
|||
if (!Token::Match(tok, "unsigned %var% [;,=]"))
|
||||
continue;
|
||||
|
||||
// Previous token should either be a symbol or one of "{};"
|
||||
// Previous token should either be a symbol or one of "{};("
|
||||
if (tok->previous() &&
|
||||
!tok->previous()->isName() &&
|
||||
!Token::Match(tok->previous(), "[{};]"))
|
||||
!Token::Match(tok->previous(), "[{};(]"))
|
||||
continue;
|
||||
|
||||
// next token should not be a standard type?
|
||||
|
|
|
@ -2320,6 +2320,13 @@ private:
|
|||
ASSERT_EQUALS(code2, tokenizeAndStringify(code1));
|
||||
}
|
||||
|
||||
// insert "int" after "unsigned"..
|
||||
{
|
||||
const char code1[] = "for (unsigned i=0; i<10; i++)";
|
||||
const char code2[] = "for ( unsigned int i = 0 ; i < 10 ; i ++ )";
|
||||
ASSERT_EQUALS(code2, tokenizeAndStringify(code1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue