Fixed #8156 (wrong ast for 'z = (x & (unsigned)1) | (y & (unsigned)2);')
This commit is contained in:
parent
e74e4c6934
commit
713f607168
|
@ -388,14 +388,18 @@ static Token * findCppTypeInitPar(Token *tok)
|
|||
{
|
||||
if (!tok || !Token::Match(tok->previous(), "[,()] %name%"))
|
||||
return nullptr;
|
||||
bool istype = false;
|
||||
while (Token::Match(tok, "%name%|::|<")) {
|
||||
if (tok->str() == "<") {
|
||||
tok = tok->link();
|
||||
if (!tok)
|
||||
return nullptr;
|
||||
}
|
||||
istype |= tok->isStandardType();
|
||||
tok = tok->next();
|
||||
}
|
||||
if (!istype)
|
||||
return nullptr;
|
||||
if (!Token::Match(tok, "[*&]"))
|
||||
return nullptr;
|
||||
while (Token::Match(tok, "[*&]"))
|
||||
|
|
|
@ -8039,6 +8039,7 @@ private:
|
|||
ASSERT_EQUALS("fint(0,(", testAst("f(int(),0);"));
|
||||
ASSERT_EQUALS("f(0,(", testAst("f(int *(),0);")); // typedef int* X; f(X(),0);
|
||||
ASSERT_EQUALS("f((0,(", testAst("f((intp)int *(),0);"));
|
||||
ASSERT_EQUALS("zx1(&y2(&|=", testAst("z = (x & (unsigned)1) | (y & (unsigned)2);")); // not type()
|
||||
|
||||
// for
|
||||
ASSERT_EQUALS("for;;(", testAst("for(;;)"));
|
||||
|
|
Loading…
Reference in New Issue