function_hooks: fake an assignment when functions return "0-s32max[$0->bar]"
commitde329024a8f85292543c23747d9d42ccfe41a88c
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 18 Jan 2018 10:19:34 +0000 (18 13:19 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 18 Jan 2018 10:19:34 +0000 (18 13:19 +0300)
tree2f49745c5b3a70fac0f3060f84f92ba75232bbb7
parent9d67605695689906f01ec1163c2932549b062219
function_hooks: fake an assignment when functions return "0-s32max[$0->bar]"

Say a function returns a parameter or a member of a parameter like this:

struct my_type *get_bar(struct foo *foo)
{
return foo->bar;
}

Then we can create a fake assignment for the caller:  my_bar = foo->bar;

The reason I didn't do this before was that it was a bit complicated to
take a string and generate an expression.  It turns out that when you
call a function, then you've already got most of the expression, you just
need to add the "->bar" part which isn't so hard.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_check_deref.c
check_deref_check.c
smatch_expressions.c
smatch_extra.h
smatch_function_hooks.c