container_of: re-write container_of()
commitaaaf2bfd6c4613db6d6722fdc0715691d11f6998
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 Mar 2019 07:47:24 +0000 (14 10:47 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 Mar 2019 08:08:40 +0000 (14 11:08 +0300)
tree914c76a7d5aeca44ada64738e3958bc81e202931
parent5b87a950193459312f0435e592492e3773de5206
container_of: re-write container_of()

The original code could only handle one lookup so you could say that
"foo->x" and "foo->y" were related but you couldn't say that "foo->x"
was related to "foo->a->b" because they were too far apart.  In a more
practical sense you couldn't describe how "pd->ops->unwind(pd);" was
a container of the function.

You still can't.  But now at least the data is stored in the DB although
I'm almost certainly going to need to change the formats to make this work
properly.

The first change is how this is stored in the DB, which is that instead of
looking at the string, I look at the expression.

Then on the other side, it had a kind of terrible brittle way of handling
the caller_info data.  The problem is that I don't want to load the caller
info data unless all the callers are the same.  In the new system I just
store the string and if it's not a &merged state after I process all the
caller info data then it's good.

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