ast: fixed tree for 'sizeof(struct S)'
This commit is contained in:
parent
c7032a8867
commit
6a3a9ee8e7
|
@ -453,6 +453,8 @@ static void compileTerm(Token *& tok, std::stack<Token*> &op)
|
||||||
while (Token::Match(tok, "(|[")) {
|
while (Token::Match(tok, "(|[")) {
|
||||||
Token *tok1 = tok;
|
Token *tok1 = tok;
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
while (Token::Match(tok,"%var% %var%")) // example: sizeof(struct S)
|
||||||
|
tok = tok->next();
|
||||||
compileExpression(tok, op);
|
compileExpression(tok, op);
|
||||||
if (!op.empty()) {
|
if (!op.empty()) {
|
||||||
tok1->astOperand2(op.top());
|
tok1->astOperand2(op.top());
|
||||||
|
|
|
@ -10100,6 +10100,8 @@ private:
|
||||||
ASSERT_EQUALS("a0>bc/?d:", testAst("(a>0) ? (b/(c)) : d;"));
|
ASSERT_EQUALS("a0>bc/?d:", testAst("(a>0) ? (b/(c)) : d;"));
|
||||||
ASSERT_EQUALS("abc/+d+", testAst("a + (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
|
// for
|
||||||
ASSERT_EQUALS("for;;(", testAst("for(;;)"));
|
ASSERT_EQUALS("for;;(", testAst("for(;;)"));
|
||||||
ASSERT_EQUALS("fora0=a8<a++;;(", testAst("for(a=0;a<8;a++)"));
|
ASSERT_EQUALS("fora0=a8<a++;;(", testAst("for(a=0;a<8;a++)"));
|
||||||
|
|
Loading…
Reference in New Issue