From ebdf50ce1a256e925518f4413ac5d3f36fd9d2eb Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 19 Sep 2012 17:04:49 +0300 Subject: [PATCH] db, function_hooks: pass assignment expression to the checks This is in preparation for some later work. The assign_return_states callbacks could take the assignment expression instead of the call expression. I'll use this in a later feature. Signed-off-by: Dan Carpenter --- smatch_function_hooks.c | 2 +- smatch_project.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/smatch_function_hooks.c b/smatch_function_hooks.c index 88eff2b8..02d33caf 100644 --- a/smatch_function_hooks.c +++ b/smatch_function_hooks.c @@ -539,7 +539,7 @@ static int db_assign_return_states_callback(void *unused, int argc, char **argv, FOR_EACH_PTR(db_implies_list, tmp) { if (tmp->type == type) - tmp->callback(db_info.expr->right, param, key, value); + tmp->callback(db_info.expr, param, key, value); } END_FOR_EACH_PTR(tmp); set_extra_expr_mod(db_info.expr->left, alloc_estate_range_list(ret_range)); diff --git a/smatch_project.c b/smatch_project.c index 5fe8261e..1279ffd4 100644 --- a/smatch_project.c +++ b/smatch_project.c @@ -49,6 +49,9 @@ static void return_implies(struct expression *call_expr, int param, char *key, c struct range_list *rl; struct expression *arg; + if (call_expr->type == EXPR_ASSIGNMENT) + call_expr = strip_expr(call_expr->right); + arg = get_argument_from_call_expr(call_expr->args, param); get_value_ranges(value, &rl); set_extra_expr_nomod(arg, alloc_estate_range_list(rl)); -- 2.11.4.GIT