AST: weird clang syntax

This commit is contained in:
Daniel Marjamäki 2017-04-10 23:05:41 +02:00
parent df90ff9f5e
commit 2c43075ece
2 changed files with 7 additions and 1 deletions

View File

@ -508,6 +508,9 @@ static bool iscpp11init(const Token * const tok)
if (!nameToken)
return false;
if (Token::Match(nameToken, "%name% { ["))
return false;
const Token *endtok = nullptr;
if (Token::Match(nameToken,"%name% {"))
endtok = nameToken->linkAt(1);

View File

@ -8046,7 +8046,10 @@ private:
ASSERT_EQUALS("a1(2+=",testAst("a=(t&)1+2;"));
ASSERT_EQUALS("ab::r&c(=", testAst("a::b& r = (a::b&)c;")); // #5261
ASSERT_EQUALS("ab10:?=", testAst("a=(b)?1:0;"));
ASSERT_EQUALS("a&(", testAst("(int (**)[i]){&a}[0][1][5] = 0;")); // TODO: This AST is incomplete however it's very weird syntax (taken from clang/test/CodeGen/vla.c)
// TODO: This AST is incomplete however it's very weird syntax (taken from clang test suite)
ASSERT_EQUALS("a&(", testAst("(int (**)[i]){&a}[0][1][5] = 0;"));
ASSERT_EQUALS("n0=", testAst("TrivialDefCtor{[2][2]}[1][1].n = 0;"));
// ({..})
ASSERT_EQUALS("a{+d+ bc+", testAst("a+({b+c;})+d"));