Print this page
11506 smatch resync

*** 74,83 **** --- 74,95 ---- return s1; return &merged; } + static bool is_local_var(struct expression *expr) + { + struct symbol *sym; + + if (!expr || expr->type != EXPR_SYMBOL) + return false; + sym = expr->symbol; + if (!(sym->ctype.modifiers & MOD_TOPLEVEL)) + return true; + return false; + } + static void match_assign(struct expression *expr) { struct expression *left; struct symbol *right_sym; char *name;
*** 86,95 **** --- 98,109 ---- int param; if (expr->op != '=') return; left = strip_expr(expr->left); + if (is_local_var(left)) + return; right_sym = expr_to_sym(expr->right); if (!right_sym) return; param = get_param_num_from_sym(right_sym);
*** 103,134 **** return; set_state_expr(my_id, expr->right, alloc_tag_data_state(tag, name, offset)); free_string(name); } - #if 0 - static void save_mtag_to_map(struct expression *expr, mtag_t tag, int offset, int param, char *key, char *value) - { - struct expression *arg, *gen_expr; - mtag_t arg_tag; - - arg = get_argument_from_call_expr(expr->args, param); - if (!arg) - return; - - gen_expr = gen_expression_from_key(arg, key); - if (!gen_expr) - return; - - if (!get_mtag(gen_expr, &arg_tag)) - arg_tag = 0; - - if (local_debug) - sm_msg("finding mtag for '%s' %lld", expr_to_str(gen_expr), arg_tag); - } - #endif - static void propogate_assignment(struct expression *expr, mtag_t tag, int offset, int param, char *key) { struct expression *arg; int orig_param; char buf[32]; --- 117,126 ----
*** 156,165 **** --- 148,158 ---- { struct expression *arg, *gen_expr; struct range_list *rl; mtag_t arg_tag; mtag_t alias; + int arg_offset; arg = get_argument_from_call_expr(expr->args, param); if (!arg) return;
*** 172,182 **** if (!create_mtag_alias(tag, expr, &alias)) return; // insert_mtag_data(alias, offset, rl); ! if (get_mtag(gen_expr, &arg_tag)) sql_insert_mtag_map(arg_tag, -offset, alias); } static void call_does_mtag_assign(struct expression *expr, int param, char *key, char *value) { --- 165,176 ---- if (!create_mtag_alias(tag, expr, &alias)) return; // insert_mtag_data(alias, offset, rl); ! // FIXME: is arg_offset handled correctly? ! if (expr_to_mtag_offset(gen_expr, &arg_tag, &arg_offset) && arg_offset == 0) sql_insert_mtag_map(arg_tag, -offset, alias); } static void call_does_mtag_assign(struct expression *expr, int param, char *key, char *value) {
*** 227,236 **** --- 221,231 ---- void register_param_to_mtag_data(int id) { my_id = id; + set_dynamic_states(my_id); add_hook(&match_assign, ASSIGNMENT_HOOK); select_return_states_hook(MTAG_ASSIGN, &call_does_mtag_assign); add_merge_hook(my_id, &merge_tag_info); add_split_return_callback(&print_stored_to_mtag); }