return_to_param: handle "return get_foo(bar);"
commit55641ccdd6d1a24b457433aec0e876a8edf0b72b
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 4 May 2017 11:09:37 +0000 (4 14:09 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 4 May 2017 11:09:37 +0000 (4 14:09 +0300)
tree549227a7886df3527586f66d9023f959a63e32d1
parent7bb2bbb9ac395ece3c31da9f0932db6d5789d468
return_to_param: handle "return get_foo(bar);"

Previously we could handle code like:

struct foo *foo = get_foo(bar);
...
return foo;

This was because we stored the mapping in foo.  But for code like:

return get_foo(bar);

We weren't saving the state anywhere, so we couldn't look it up.  With this
patch we save a kind of bogus state for the return and then we look it up.

I shifted some of the code in smatch_parse_call_math.c around to create a
helper function.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch.h
smatch_parse_call_math.c
smatch_return_to_param.c