AST: fixes for more new statements from clang test suite
This commit is contained in:
parent
dd6ae3033f
commit
4783a67042
|
@ -659,10 +659,14 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
|
|||
} else if (state.cpp && Token::Match(tok, "new %var%|::|(")) {
|
||||
Token* newtok = tok;
|
||||
tok = tok->next();
|
||||
if (tok->str() == "(" && Token::Match(tok->link(), ") %type%"))
|
||||
tok = tok->link()->next();
|
||||
else if (Token::Match(tok, "( %type%") && Token::simpleMatch(tok->link(), ") ( )"))
|
||||
tok = tok->next();
|
||||
if (tok->str() == "(") {
|
||||
if (Token::Match(tok, "( %var% ) ( %type%") && Token::simpleMatch(tok->link()->linkAt(1), ") ("))
|
||||
tok = tok->link()->next();
|
||||
if (Token::Match(tok->link(), ") %type%"))
|
||||
tok = tok->link()->next();
|
||||
else if (Token::Match(tok, "( %type%") && Token::Match(tok->link(), ") [(;]"))
|
||||
tok = tok->next();
|
||||
}
|
||||
state.op.push(tok);
|
||||
while (Token::Match(tok, "%var%|*|&|<")) {
|
||||
if (tok->link())
|
||||
|
|
|
@ -8387,8 +8387,10 @@ private:
|
|||
|
||||
// clang testsuite..
|
||||
ASSERT_EQUALS("const0(new", testAst("new const auto (0);"));
|
||||
ASSERT_EQUALS("auto0.0(new", testAst("new (auto) (0.0);"));
|
||||
ASSERT_EQUALS("autonew", testAst("new (auto) (0.0);"));
|
||||
ASSERT_EQUALS("intnew", testAst("new (int S::*[3][4][5]) ();"));
|
||||
ASSERT_EQUALS("pSnew=", testAst("p=new (x)(S)(1,2);"));
|
||||
ASSERT_EQUALS("inti[new(", testAst("(void)new (int[i]);"));
|
||||
}
|
||||
|
||||
void astpar() const { // parentheses
|
||||
|
|
Loading…
Reference in New Issue