Minor sanity features for bit_set

This commit is contained in:
gingerBill
2018-08-14 19:22:48 +01:00
parent c7d6467cfa
commit 71f94bff76
5 changed files with 68 additions and 43 deletions

View File

@@ -503,16 +503,6 @@ i64 check_distance_between_types(CheckerContext *c, Operand *operand, Type *type
}
}
// if (is_type_bit_set(dst) && are_types_identical(dst->BitSet.base_type, operand->type)) {
// return 3;
// }
#if 0
if (are_types_identical(dst, src) && (!is_type_named(dst) || !is_type_named(src))) {
return 1;
}
#endif
if (is_type_bit_field_value(operand->type) && is_type_integer(type)) {
Type *bfv = base_type(operand->type);
i32 bits = bfv->BitFieldValue.bits;
@@ -2002,7 +1992,7 @@ bool check_binary_array_expr(CheckerContext *c, Token op, Operand *x, Operand *y
}
void check_binary_expr(CheckerContext *c, Operand *x, Ast *node) {
void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, bool use_lhs_as_type_hint=false) {
GB_ASSERT(node->kind == Ast_BinaryExpr);
Operand y_ = {}, *y = &y_;
@@ -2065,7 +2055,11 @@ void check_binary_expr(CheckerContext *c, Operand *x, Ast *node) {
default:
check_expr(c, x, be->left);
check_expr(c, y, be->right);
if (use_lhs_as_type_hint) {
check_expr_with_type_hint(c, y, be->right, x->type);
} else {
check_expr(c, y, be->right);
}
break;
}
if (x->mode == Addressing_Invalid) {