flow, struct_assignment, clear_buffer: improve how memcpy() is handled
commitd94be057989706e5feb4cc61e4298610cb275bc2
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 21 Jan 2014 11:48:23 +0000 (21 14:48 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Tue, 21 Jan 2014 11:48:23 +0000 (21 14:48 +0300)
tree60ab56a3def20f3d214222df99239ad94b064952
parent3ef1e73ee3f7fcbe01a8800bc1c0017e97b46e4c
flow, struct_assignment, clear_buffer: improve how memcpy() is handled

If you're copying structs with "memcpy(&foo, &bar, sizeof(foo));" then
that's basically the same as saying "foo = bar;".  So I'm re-using the
struct assignment code to handle that.

The old code in smatch_clear_buffer.c just did "foo = foo;" which causes
a problem if we know already know the value of "foo.x".  These days we
have a better implementation of unknown_value_expression() so we can do
better.

I also disabled nesting.  I capped nesting in smatch_flow.c but I also
disabled it outright in smatch_struct_assignment.c.  I expect that code to
change in the future.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch.h
smatch_clear_buffer.c
smatch_flow.c
smatch_struct_assignment.c