AST: Better handling of '(type){..}'
This commit is contained in:
parent
40914159a8
commit
1008868506
|
@ -1341,7 +1341,7 @@ std::pair<const Token *, const Token *> Token::findExpressionStartEndTokens() co
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (Token::Match(end,"(|[") &&
|
||||
if (Token::Match(end,"(|[|{") &&
|
||||
!(Token::Match(end, "( %type%") && !end->astOperand2())) {
|
||||
end = end->link();
|
||||
break;
|
||||
|
|
|
@ -994,7 +994,7 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
|
|||
castTok->isCast(true);
|
||||
tok = tok->link()->next();
|
||||
const int inArrayAssignment = state.inArrayAssignment;
|
||||
if (Token::Match(tok, "{ . %name% ="))
|
||||
if (tok && tok->str() == "{")
|
||||
state.inArrayAssignment = 1;
|
||||
compilePrecedence3(tok, state);
|
||||
state.inArrayAssignment = inArrayAssignment;
|
||||
|
|
|
@ -2402,9 +2402,8 @@ private:
|
|||
"struct bstr bstr0 ( const char * s ) { "
|
||||
"return ( struct bstr ) { ( unsigned char * ) s , s ? strlen ( s ) : 0 } ; "
|
||||
"}";
|
||||
TODO_ASSERT_THROW(tok(code, false), InternalError); // TODO: Do not produce bad AST
|
||||
//ASSERT_EQUALS(expected, tok(code, false));
|
||||
//ASSERT_EQUALS("", errout.str());
|
||||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void simplifyTypedef118() { // #5749
|
||||
|
|
Loading…
Reference in New Issue