From 9359a56056f005e7b56aa52c14f9790b7ccc4e4b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 15 Apr 2013 11:49:11 +0300 Subject: [PATCH] extra: small fix for when the database is disabled but we have inline info This is to change how this is handled: foo(&bar); In the original code if there wasn't a cross function database then it just resets the struct. But in the new code if we have the information in the in-memory database then we use that instead of blindly clearing it. Signed-off-by: Dan Carpenter --- smatch_extra.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/smatch_extra.c b/smatch_extra.c index 79ea0dcb..a65276d4 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -434,6 +434,12 @@ static void match_function_call(struct expression *expr) struct expression *tmp; struct state_list *slist; + /* if we have the db this is handled in smatch_function_hooks.c */ + if (!option_no_db) + return; + if (inlinable(expr->fn)) + return; + slist = get_all_states(SMATCH_EXTRA); FOR_EACH_PTR(expr->args, arg) { @@ -1334,8 +1340,7 @@ void register_smatch_extra_late(int id) add_hook(&match_pointer_as_array, OP_HOOK); add_db_fn_call_callback(DEREFERENCE, &set_param_dereferenced); add_indirect_modification_hook(SMATCH_EXTRA, reset_struct_members); - if (option_no_db) - add_hook(&match_function_call, FUNCTION_CALL_HOOK); + add_hook(&match_function_call, FUNCTION_CALL_HOOK); add_hook(&match_assign, ASSIGNMENT_HOOK); add_hook(&unop_expr, OP_HOOK); add_hook(&asm_expr, ASM_HOOK); -- 2.11.4.GIT