type: introduce get_final_type()
commitd79671fe59b3f77ac988b708adeba65dc1d518ea
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 24 Jul 2018 16:41:33 +0000 (24 19:41 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Tue, 24 Jul 2018 16:41:33 +0000 (24 19:41 +0300)
tree9f6ebf56f3c7856f6d150b3d6a1b63a078c53f4d
parent1936872b697de0f523057a68d50d7ff877931ca5
type: introduce get_final_type()

The problem here is that "ptr + 1 - ptr" isn't working.  When we do the
subtraction then get_type() says that the type for the subtraction is
ssize_t.  But in sval_binop() we want to do a pointer math subtraction so
we want the type to be a pointer type.

But really the result *should* be ssize_t, so that's correct.  I have
introduced get_final_type() which gets the final type for an operation.
Probably I should rename get_type() instead, but that seems like a lot
of changes.  And I really don't know which code cares about the final
type...  When we use the resulting range_list then it gets casted anyway...

Anyway, if we need the final type then the function is there for us.

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