Currently, if the analyzer evaluates an expression like to - from, it only computes reasonable answer if both are representing ElementRegions.
This patch aims to extends the analyzer to be able to evaluate certain pointer arithmetic operations.
Formally, for all memory region X and for all NonLoc n, m:
Evaluate:
- Element{X,n} - Element{X,m} => n-m
- Element{X,n} - X => n
- X - Element{X,n} => -n
- Element{X,n} == X => true/falsedepending on n is zero or not.
- etc.
I would prefer having a comment for this line with a very simple formula of the thing we are calculating. I think it can increase the readability of the code because when there is a call accepting a whole bunch of arguments it is never obvious and it always takes time to parse through.