ast: fixed tree for 'sizeof(struct S)'

This commit is contained in:
Daniel Marjamäki 2014-01-18 13:18:11 +01:00
parent c7032a8867
commit 6a3a9ee8e7
2 changed files with 4 additions and 0 deletions

View File

@ -453,6 +453,8 @@ static void compileTerm(Token *& tok, std::stack<Token*> &op)
while (Token::Match(tok, "(|[")) {
Token *tok1 = tok;
tok = tok->next();
while (Token::Match(tok,"%var% %var%")) // example: sizeof(struct S)
tok = tok->next();
compileExpression(tok, op);
if (!op.empty()) {
tok1->astOperand2(op.top());

View File

@ -10100,6 +10100,8 @@ private:
ASSERT_EQUALS("a0>bc/?d:", testAst("(a>0) ? (b/(c)) : d;"));
ASSERT_EQUALS("abc/+d+", testAst("a + (b/(c)) + d;"));
ASSERT_EQUALS("absizeofd(ef.+(=", testAst("a = b(sizeof(c d) + e.f)"));
// for
ASSERT_EQUALS("for;;(", testAst("for(;;)"));
ASSERT_EQUALS("fora0=a8<a++;;(", testAst("for(a=0;a<8;a++)"));