Make sure that we do not add SymbolCast at the very boundary of
the range in which the cast would not certainly happen.
Differential Revision: http://reviews.llvm.org/D16178
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258039
91177308-0d34-0410-b5e6-
96231b3b80d8
NonLoc FromVal = val.castAs<NonLoc>();
QualType CmpTy = getConditionType();
NonLoc CompVal =
- evalBinOpNN(state, BO_LT, FromVal, ToTypeMaxVal, CmpTy).castAs<NonLoc>();
+ evalBinOpNN(state, BO_LE, FromVal, ToTypeMaxVal, CmpTy).castAs<NonLoc>();
ProgramStateRef IsNotTruncated, IsTruncated;
std::tie(IsNotTruncated, IsTruncated) = state->assume(CompVal);
if (!IsNotTruncated && IsTruncated) {
BOOL x = y; // expected-warning {{Assignment of a non-Boolean value}}
return;
}
+ if (y > 200 && y < 250) {
+ // FIXME: Currently we are loosing this warning due to a SymbolCast in RHS.
+ BOOL x = y; // no-warning
+ return;
+ }
+ if (y >= 127 && y < 150) {
+ BOOL x = y; // expected-warning{{Assignment of a non-Boolean value}}
+ return;
+ }
if (y > 1) {
BOOL x = y; // expected-warning {{Assignment of a non-Boolean value}}
return;