tokenizer: fixed TestTokenizer::sizeof1
This commit is contained in:
parent
dd9cd9ce82
commit
b7b055e885
|
@ -675,7 +675,19 @@ void Tokenizer::simplifyTokenList()
|
|||
|
||||
else if (Token::Match(tok, "sizeof ( * %var% )"))
|
||||
{
|
||||
tok->str("100");
|
||||
// Some default value..
|
||||
int sz = 100;
|
||||
|
||||
// Try to locate variable declaration..
|
||||
const Token *decltok = Token::findmatch(_tokens, (std::string("%type% ") + tok->strAt(3) + " [").c_str());
|
||||
if (decltok)
|
||||
{
|
||||
sz = SizeOfType(decltok->strAt(0));
|
||||
}
|
||||
|
||||
std::ostringstream ostr;
|
||||
ostr << sz;
|
||||
tok->str(ostr.str().c_str());
|
||||
for (int i = 0; i < 4; ++i)
|
||||
tok->deleteNext();
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ private:
|
|||
TEST_CASE(noerr2);
|
||||
TEST_CASE(noerr3);
|
||||
TEST_CASE(noerr4);
|
||||
|
||||
|
||||
TEST_CASE(sizeof1);
|
||||
|
||||
TEST_CASE(array_index_1);
|
||||
|
|
Loading…
Reference in New Issue