flow: handle function scope hooks better
commite3dae12ac5b6f3ee2ae2a6ff62fb4c66291869fa
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 11 Sep 2023 10:16:38 +0000 (11 13:16 +0300)
committerDan Carpenter <dan.carpenter@linaro.org>
Mon, 11 Sep 2023 10:16:38 +0000 (11 13:16 +0300)
treedc4e7ab30d95518b84d1abdbb6839bd8c9a433c6
parent865fd27a0aa7b2c46716cca7eb00e027ce5990ef
flow: handle function scope hooks better

This commit is messier than I would have liked.  What happened is that at
first I thought maybe each function should have it's own scope.  So I
introduced the parse_fn_statements() to make that easier. But then I
realized that actually the {} in the function create a function scope hook.

The issue is that function scope has to be handled specially because there
are a bunch of hooks we want to run at the end of the function and we want
the to do it before the scope hooks have completed.  Or if you want it to
run after the scope hooks then use AFTER_FUNC_HOOK.  The test for if a
scope was the function scope was badly done, so I have re-written that.

I think the code was not just ugly, but also buggy except I'm not sure what
I was thinking so maybe it was just ugly.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
smatch_flow.c