parent
1dd19dcaef
commit
401f0de18b
|
@ -1540,7 +1540,7 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
||||||
if (Token::Match(tok, "%type% <") && tok->linkAt(1) && !Token::Match(tok->linkAt(1), "> [({]"))
|
if (Token::Match(tok, "%type% <") && tok->linkAt(1) && !Token::Match(tok->linkAt(1), "> [({]"))
|
||||||
return tok->linkAt(1);
|
return tok->linkAt(1);
|
||||||
|
|
||||||
if (cpp && Token::Match(tok, "%type% ::|<|%name%")) {
|
if (cpp && !tok->isKeyword() && Token::Match(tok, "%type% ::|<|%name%")) {
|
||||||
Token *tok2 = tok;
|
Token *tok2 = tok;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (Token::Match(tok2, "%name%|> :: %name%"))
|
if (Token::Match(tok2, "%name%|> :: %name%"))
|
||||||
|
@ -1559,7 +1559,7 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token::Match(tok, "%type% %name%|*|&|::") && tok->str() != "return") {
|
if (Token::Match(tok, "%type% %name%|*|&|::") && !Token::Match(tok, "return|new")) {
|
||||||
int typecount = 0;
|
int typecount = 0;
|
||||||
Token *typetok = tok;
|
Token *typetok = tok;
|
||||||
while (Token::Match(typetok, "%type%|::|*|&")) {
|
while (Token::Match(typetok, "%type%|::|*|&")) {
|
||||||
|
|
|
@ -6032,6 +6032,7 @@ private:
|
||||||
ASSERT_EQUALS("adelete", testAst("void f() { delete a; }"));
|
ASSERT_EQUALS("adelete", testAst("void f() { delete a; }"));
|
||||||
ASSERT_EQUALS("Aa*A{new=", testAst("A* a = new A{};"));
|
ASSERT_EQUALS("Aa*A{new=", testAst("A* a = new A{};"));
|
||||||
ASSERT_EQUALS("Aa*A12,{new=", testAst("A* a = new A{ 1, 2 };"));
|
ASSERT_EQUALS("Aa*A12,{new=", testAst("A* a = new A{ 1, 2 };"));
|
||||||
|
ASSERT_EQUALS("Sv0[(new", testAst("new S(v[0]);")); // #10929
|
||||||
|
|
||||||
// placement new
|
// placement new
|
||||||
ASSERT_EQUALS("X12,3,(new ab,c,", testAst("new (a,b,c) X(1,2,3);"));
|
ASSERT_EQUALS("X12,3,(new ab,c,", testAst("new (a,b,c) X(1,2,3);"));
|
||||||
|
|
Loading…
Reference in New Issue