assigned_expr: handle fake parameter assignments
commit95990a259761446ae0708e3d682de97d18c31417
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 1 Nov 2023 12:00:36 +0000 (1 15:00 +0300)
committerDan Carpenter <dan.carpenter@linaro.org>
Wed, 1 Nov 2023 12:00:36 +0000 (1 15:00 +0300)
tree149a6da0121e62fb1955c885ae4095720734b757
parent69ba31d9c28b21a09f3b41c67b14e2d1c1161f1b
assigned_expr: handle fake parameter assignments

Say you have a function that does:

int frob(struct something *p)
{
return p->x;
}

And the caller looks like:

val = frob(p);

Then this gets split into val = p->x and val = frob().  In the original
code the val = frob(); assignment would overwrite the "val = p->x"
assignment.  The result ends up being &undefined, actually and not frob().
What a useless thing.

Save the "val = p->x" assignment.

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