extra: don't use the indirect_modification_hook
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 17 Apr 2013 15:59:20 +0000 (17 18:59 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Wed, 17 Apr 2013 15:59:20 +0000 (17 18:59 +0300)
The problem here is that when you have:

some_function(&bar);

It would reset all the members of bar, but really smatch_db.c should handle
that.  Really smatch_modification_hooks.c isn't the right idea.  Smatch
extra already has all this information and everything should be built
around that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_extra.c

index 7db9d30..e208584 100644 (file)
@@ -623,13 +623,6 @@ free:
        free_string(name);
 }
 
-static void reset_struct_members(struct sm_state *sm)
-{
-       if (!estate_rl(sm->state))
-               return;
-       set_extra_mod(sm->name, sm->sym, alloc_estate_whole(estate_type(sm->state)));
-}
-
 static struct smatch_state *increment_state(struct smatch_state *state)
 {
        sval_t min = estate_min(state);
@@ -1285,7 +1278,6 @@ void register_smatch_extra_late(int id)
        add_hook(&match_dereferences, DEREF_HOOK);
        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);
        add_hook(&match_function_call, FUNCTION_CALL_HOOK);
        add_hook(&match_assign, ASSIGNMENT_HOOK);
        add_hook(&unop_expr, OP_HOOK);