Lines Matching refs:type

32 	if (sym->type == SYM_BASETYPE)  in get_real_base_type()
37 if (ret->type == SYM_RESTRICT || ret->type == SYM_NODE) in get_real_base_type()
42 int type_bytes(struct symbol *type) in type_bytes() argument
46 if (type && type->type == SYM_ARRAY) in type_bytes()
47 return array_bytes(type); in type_bytes()
49 bits = type_bits(type); in type_bytes()
55 int array_bytes(struct symbol *type) in array_bytes() argument
57 if (!type || type->type != SYM_ARRAY) in array_bytes()
59 return bits_to_bytes(type->bit_size); in array_bytes()
102 if (left->type == SYM_PTR || left->type == SYM_ARRAY) in get_binop_type()
104 if (right->type == SYM_PTR || right->type == SYM_ARRAY) in get_binop_type()
117 if (!expr || expr->type != EXPR_SYMBOL || !expr->symbol) in get_type_symbol()
147 if (!expr || expr->type != EXPR_DEREF) in get_symbol_from_deref()
156 if (sym->type == SYM_PTR) in get_symbol_from_deref()
192 if (tmp->type != SYM_FN) in get_return_type()
199 if (stmt->type != STMT_COMPOUND) in get_expr_stmt_type()
202 if (stmt->type == STMT_LABEL) in get_expr_stmt_type()
204 if (stmt->type != STMT_EXPRESSION) in get_expr_stmt_type()
234 if (sym->type == SYM_NODE) { in get_pointer_type()
239 if (sym->type != SYM_PTR && sym->type != SYM_ARRAY) in get_pointer_type()
269 switch (expr->type) { in get_type_helper()
323 if (ret && ret->type == SYM_TYPEOF) in get_type_helper()
344 if (expr->type == EXPR_COMPARE) in get_final_type_helper()
420 if (!sym || sym->type != SYM_FN) in returns_unsigned()
436 if (!sym || sym->type != SYM_FN) in returns_pointer()
439 if (sym && sym->type == SYM_PTR) in returns_pointer()
444 static sval_t fp_max(struct symbol *type) in fp_max() argument
446 sval_t ret = { .type = type }; in fp_max()
448 if (type == &float_ctype) in fp_max()
450 else if (type == &double_ctype) in fp_max()
467 ret.type = base_type; in sval_type_max()
473 static sval_t fp_min(struct symbol *type) in fp_min() argument
475 sval_t ret = { .type = type }; in fp_min()
477 if (type == &float_ctype) in fp_min()
479 else if (type == &double_ctype) in fp_min()
496 ret.type = base_type; in sval_type_min()
510 struct symbol *type; in nr_bits() local
512 type = get_type(expr); in nr_bits()
513 if (!type) in nr_bits()
515 return type_bits(type); in nr_bits()
520 struct symbol *type; in is_void_pointer() local
522 type = get_type(expr); in is_void_pointer()
523 if (!type || type->type != SYM_PTR) in is_void_pointer()
525 type = get_real_base_type(type); in is_void_pointer()
526 if (type == &void_ctype) in is_void_pointer()
533 struct symbol *type; in is_char_pointer() local
535 type = get_type(expr); in is_char_pointer()
536 if (!type || type->type != SYM_PTR) in is_char_pointer()
538 type = get_real_base_type(type); in is_char_pointer()
539 if (type == &char_ctype) in is_char_pointer()
547 if (!expr || expr->type != EXPR_STRING) in is_string()
554 bool is_struct_ptr(struct symbol *type) in is_struct_ptr() argument
556 if (!type || type->type != SYM_PTR) in is_struct_ptr()
558 type = get_real_base_type(type); in is_struct_ptr()
559 if (!type || type->type != SYM_STRUCT) in is_struct_ptr()
585 if (!expr || expr->type != EXPR_SYMBOL || !expr->symbol) in is_local_variable()
599 if (one->type != two->type) in types_equiv()
601 if (one->type == SYM_PTR) in types_equiv()
608 bool type_fits(struct symbol *type, struct symbol *test) in type_fits() argument
610 if (!type || !test) in type_fits()
613 if (type == test) in type_fits()
616 if (type_bits(test) > type_bits(type)) in type_fits()
618 if (type_signed(test) && !type_signed(type)) in type_fits()
620 if (type_positive_bits(test) > type_positive_bits(type)) in type_fits()
643 if (!sym || sym->type != SYM_FN) in cur_func_return_type()
659 if (fn_type->type == SYM_PTR) in get_arg_type()
661 if (fn_type->type != SYM_FN) in get_arg_type()
702 if (sub->type == SYM_PTR) in get_member_from_string()
723 if (!sym || sym->type != SYM_PTR) in get_member_type_from_key()
731 if (sym->type == SYM_PTR) in get_member_type_from_key()
746 if (sym->type == SYM_RESTRICT || sym->type == SYM_NODE) in get_member_type_from_key()
749 if (!sym || sym->type != SYM_PTR) in get_member_type_from_key()
758 struct symbol *type; in get_arg_type_from_key() local
765 type = get_arg_type(fn, param); in get_arg_type_from_key()
766 if (!type || type->type != SYM_PTR) in get_arg_type_from_key()
768 return get_real_base_type(type); in get_arg_type_from_key()
775 struct symbol *type; in is_struct() local
777 type = get_type(expr); in is_struct()
778 if (type && type->type == SYM_STRUCT) in is_struct()
831 static int type_str_helper(char *buf, int size, struct symbol *type) in type_str_helper() argument
835 if (!type) in type_str_helper()
838 if (type->type == SYM_BASETYPE) { in type_str_helper()
839 return snprintf(buf, size, "%s", base_type_str(type)); in type_str_helper()
840 } else if (type->type == SYM_PTR) { in type_str_helper()
841 type = get_real_base_type(type); in type_str_helper()
842 n = type_str_helper(buf, size, type); in type_str_helper()
846 } else if (type->type == SYM_ARRAY) { in type_str_helper()
847 type = get_real_base_type(type); in type_str_helper()
848 n = type_str_helper(buf, size, type); in type_str_helper()
852 } else if (type->type == SYM_STRUCT) { in type_str_helper()
853 return snprintf(buf, size, "struct %s", type->ident ? type->ident->name : ""); in type_str_helper()
854 } else if (type->type == SYM_UNION) { in type_str_helper()
855 if (type->ident) in type_str_helper()
856 return snprintf(buf, size, "union %s", type->ident->name); in type_str_helper()
859 } else if (type->type == SYM_FN) { in type_str_helper()
863 return_type = get_real_base_type(type); in type_str_helper()
872 FOR_EACH_PTR(type->arguments, arg) { in type_str_helper()
884 } else if (type->type == SYM_NODE) { in type_str_helper()
888 type = get_real_base_type(type); in type_str_helper()
889 n += type_str_helper(buf + n, size - n, type); in type_str_helper()
893 } else if (type->type == SYM_ENUM) { in type_str_helper()
894 return snprintf(buf, size, "enum %s", type->ident ? type->ident->name : "<unknown>"); in type_str_helper()
896 return snprintf(buf, size, "<type %d>", type->type); in type_str_helper()
900 char *type_to_str(struct symbol *type) in type_to_str() argument
905 type_str_helper(buf, sizeof(buf), type); in type_to_str()