AST: Do not generate AST for decltype

This commit is contained in:
Daniel Marjamäki 2020-11-15 16:47:36 +01:00
parent 65e0694fc6
commit 7878eb2512
2 changed files with 3 additions and 0 deletions

View File

@ -1390,6 +1390,8 @@ static Token * findAstTop(Token *tok1, Token *tok2)
static Token * createAstAtToken(Token *tok, bool cpp)
{
if (cpp && Token::simpleMatch(tok, "decltype ("))
return tok->linkAt(1);
if (Token::simpleMatch(tok, "for (")) {
if (cpp && Token::Match(tok, "for ( const| auto &|&&| [")) {
Token *decl = Token::findsimplematch(tok, "[");

View File

@ -7887,6 +7887,7 @@ private:
ASSERT_EQUALS("unoRef:: var0(", testAst(code1));
ASSERT_EQUALS("vary=", testAst("std::string var = y;"));
ASSERT_EQUALS("var1=", testAst("decltype(x) var = 1;"));
}
void astunaryop() { // unary operators