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

This commit is contained in:
Roberto Raggi
2009-06-18 14:13:44 +02:00
parent d8b589ceff
commit 44aa96fcf5

View File

@@ -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;
}
}
}