AST: fixed cast for 'return (long long)c << 40;'

This commit is contained in:
Daniel Marjamäki 2014-09-12 06:43:52 +02:00
parent e2136adf5b
commit 0ab7abded1
2 changed files with 2 additions and 2 deletions

View File

@ -435,7 +435,7 @@ static bool iscast(const Token *tok)
if (!Token::Match(tok, "( %var%"))
return false;
if (tok->previous() && tok->previous()->isName())
if (tok->previous() && tok->previous()->isName() && tok->previous()->str() != "return")
return false;
if (Token::Match(tok, "( (| typeof (") && Token::Match(tok->link(), ") %num%"))

View File

@ -10982,7 +10982,7 @@ private:
ASSERT_EQUALS("ac-(=", testAst("a = (long)-c;"));
ASSERT_EQUALS("ac(=", testAst("a = (some<strange, type>)c;"));
ASSERT_EQUALS("afoveon_avgimage((foveon_avgimage((+=", testAst("a = foveon_avg(((short(*)[4]) image)) + foveon_avg(((short(*)[4]) image));"));
ASSERT_EQUALS("c(40<<return", testAst("return (long long)c << 40;"));
ASSERT_EQUALS("ab-(=", testAst("a = ((int)-b)")); // Multiple subsequent unary operators (cast and -)
}