forked from OSchip/llvm-project
881b6a009f
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. Reviewed By: stevewan Differential Revision: https://reviews.llvm.org/D115349 |
||
---|---|---|
.. | ||
AnalyzerOptionsTest.cpp | ||
BugReportInterestingnessTest.cpp | ||
CMakeLists.txt | ||
CallDescriptionTest.cpp | ||
CallEventTest.cpp | ||
CheckerRegistration.h | ||
ConflictingEvalCallsTest.cpp | ||
FalsePositiveRefutationBRVisitorTest.cpp | ||
NoStateChangeFuncVisitorTest.cpp | ||
ParamRegionTest.cpp | ||
RangeSetTest.cpp | ||
RegisterCustomCheckersTest.cpp | ||
Reusables.h | ||
SValTest.cpp | ||
StoreTest.cpp | ||
SymbolReaperTest.cpp | ||
TestReturnValueUnderConstruction.cpp |