Fixed #7976 (Internal error. Token::astOperand1() cyclic dependency. (ticket nr 2, new regression))
This commit is contained in:
parent
1f83c014d5
commit
e6ed08c4d8
|
@ -1014,11 +1014,15 @@ static void createAstAtTokenInner(Token * const tok1, const Token *endToken, boo
|
|||
tok->astParent()->astParent()->astOperand1() &&
|
||||
tok == tok->astParent()->astParent()->astOperand1()->astOperand1())
|
||||
;
|
||||
// function argument is initializer list
|
||||
else if (tok->astParent() && (tok->astParent()->str() == "," || Token::Match(tok->astParent()->previous(), "%name% (")))
|
||||
;
|
||||
else
|
||||
else {
|
||||
// function argument is initializer list?
|
||||
const Token *parent = tok->astParent();
|
||||
while (Token::simpleMatch(parent, ","))
|
||||
parent = parent->astParent();
|
||||
if (!parent || !Token::Match(parent->previous(), "%name% ("))
|
||||
// not function argument..
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Token::simpleMatch(tok->previous(), "( { ."))
|
||||
break;
|
||||
|
|
|
@ -8054,6 +8054,7 @@ private:
|
|||
// struct initialization
|
||||
ASSERT_EQUALS("name_bytes[bits~unusedBits>>unusedBits<<{=", testAst("const uint8_t name_bytes[] = { (~bits >> unusedBits) << unusedBits };"));
|
||||
ASSERT_EQUALS("abuf0{={=", testAst("a = { .buf = { 0 } };"));
|
||||
ASSERT_EQUALS("ab2[a0=b0=,{a0=b0=,{,{=", testAst("struct AB ab[2] = { { .a=0, .b=0 }, { .a=0, .b=0 } };"));
|
||||
ASSERT_EQUALS("tset{=", testAst("struct cgroup_taskset tset = {};"));
|
||||
ASSERT_EQUALS("s1a&,{2b&,{,{=", testAst("s = { {1, &a}, {2, &b} };"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue