Commit 44aa96fc authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Disable the undefined-type check for all the C-cast expressions.

parent d8b589ce
......@@ -529,27 +529,22 @@ protected:
return true;
}
virtual bool visit(BinaryExpressionAST *ast)
virtual bool visit(CastExpressionAST *ast)
{
if (ast->right_expression) {
if (CastExpressionAST *right_cast_expr = ast->right_expression->asCastExpression()) {
if (right_cast_expr->type_id) {
if (TypeIdAST *right_cast_type_id = right_cast_expr->type_id->asTypeId()) {
SpecifierAST *type_specifier = right_cast_type_id->type_specifier;
if (! right_cast_type_id->declarator && type_specifier && ! type_specifier->next &&
type_specifier->asNamedTypeSpecifier() && right_cast_expr->expression &&
right_cast_expr->expression->asUnaryExpression()) {
// this ast node is ambigious, e.g.
// 1 + (a) + b
// it can be parsed as
// 1 + ((a) + b)
// or
// 1 + (a) (+b)
accept(ast->left_expression);
accept(right_cast_expr->expression);
return false;
}
}
if (ast->lparen_token && ast->type_id && ast->rparen_token && ast->expression) {
if (TypeIdAST *cast_type_id = ast->type_id->asTypeId()) {
SpecifierAST *type_specifier = cast_type_id->type_specifier;
if (! cast_type_id->declarator && type_specifier && ! type_specifier->next &&
type_specifier->asNamedTypeSpecifier() && ast->expression &&
ast->expression->asUnaryExpression()) {
// this ast node is ambigious, e.g.
// (a) + b
// it can be parsed as
// ((a) + b)
// or
// (a) (+b)
accept(ast->expression);
return false;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment