flow: clear out fake assignments after they're not required
commit690460d76ea035c1d548fe0eb275554d8ba4dc6b
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Oct 2020 09:02:19 +0000 (23 12:02 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Oct 2020 09:02:19 +0000 (23 12:02 +0300)
treebb64a91d2fcc7d0b41eb09c5f71e0f75ab10772a
parent56de2ac7cd9530735548ed5a1f3378a986c8edf5
flow: clear out fake assignments after they're not required

When we fake a parameter assignment then after we finished parsing the call
the states are not required.  It's helpful to clear them out of the
cur_stree, so that we don't have to handle unmatched states, merges and
all the memory overhead from tracking and storing them.

This only affects fake parameter assignments because for fake return
assignments, the return is the end of the code path.

There was originally code to do this, but I hadn't looked at it closely
and that code is broken and never cleared anything out.  At the end of
split_stmt() the condition "if (--indent_cnt == 0)" should have had a 1
instead of a 0.  We are never indented zero tabs.

Also we can sometimes clear it out even faster if it's a simple call
instead of a function call assignment so I've added that to the EXPR_CALL
parsing.

I've also changed name of the fake expressions, I don't know that this is
important.  I was focused on parameter assignments.  Probably it's like I
said earlier where if return assignments don't matter either way.

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