Fix AST cyclic dependency [cppcheckError] (#3945)

This commit is contained in:
chrchr-github 2022-03-26 22:39:14 +01:00 committed by GitHub
parent 5ed521622f
commit 1dd19dcaef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -814,7 +814,7 @@ static void compileTerm(Token *&tok, AST_state& state)
state.op.push(tok);
if (Token::Match(tok, "%name% <") && tok->linkAt(1))
tok = tok->linkAt(1);
else if (Token::Match(tok, "%name% ...") || (state.op.size() == 1 && Token::Match(tok->tokAt(-2), ") ( %name% ) =")))
else if (Token::Match(tok, "%name% ...") || (state.op.size() == 1 && state.depth == 0 && Token::Match(tok->tokAt(-2), ") ( %name% ) =")))
tok = tok->next();
tok = tok->next();
if (Token::Match(tok, "%str%")) {

View File

@ -6220,6 +6220,7 @@ private:
"}\n"));
ASSERT_EQUALS("x0=a, stdtie::a(x=", testAst("int x = 0, a; std::tie(a) = x;\n"));
ASSERT_EQUALS("tmpa*=a*b*=,b*tmp=,", testAst("{ ((tmp) = (*a)), ((*a) = (*b)), ((*b) = (tmp)); }"));
ASSERT_EQUALS("a(*v=", testAst("(*(volatile unsigned int *)(a) = (v));"));
}
void astunaryop() { // unary operators