Some tests were skipped in D114454 to resolve test failures on some
platforms, where the pointers have different bitwidth than expected.
This patch re-enables these tests, by relaxing the requirements on the
types of the SVal.
The issue:
There is no way to reconstruct the type of the SVal perfectly
accurately, since there could be multiple types having the required
bitwidth and signedness.
Consider platforms where int and long have the same bitwidth.
Additionally, we need to be careful about casting a pointer to an
integral representation, because we don't know what smallest integral
type can represent that.
To workaround these issues, I propose enforcing a type that has the
same signedness and bitwidth as the expected type, instead of perfect
equality.
In the GetLocAsIntType test, in case of pointer-to-integral casts
I'm using the widest standard integral type (long long) to make sure
that the pointer can be represented by the type without losing
precision. This won't affect the test in any meaningful way, since the
type of the lvalue remained the same.
In one case, I had to replace getUIntPtrType() with UnsignedLongTy
because on some platforms getUIntPtrType() is different then `long
int`.
In this patch, I also enforce that the tests must compile without
errors, to prevent narrowing conversions in the future.
Okay this reminded me that I wanted to ask this dumb question. Don't the assignments eventually do the implicit down-casting? Is it fine because we are not dealing with anything concrete and just doing static analysis over the code?