|
@@ -71,18 +71,15 @@ SVal SimpleSValBuilder::dispatchCast(SVal Val, QualType CastTy) {
|
|
|
}
|
|
|
|
|
|
SVal SimpleSValBuilder::evalCastFromNonLoc(NonLoc val, QualType castTy) {
|
|
|
-
|
|
|
bool isLocType = Loc::isLocType(castTy);
|
|
|
-
|
|
|
if (val.getAs<nonloc::PointerToMember>())
|
|
|
return val;
|
|
|
|
|
|
if (Optional<nonloc::LocAsInteger> LI = val.getAs<nonloc::LocAsInteger>()) {
|
|
|
if (isLocType)
|
|
|
return LI->getLoc();
|
|
|
-
|
|
|
// FIXME: Correctly support promotions/truncations.
|
|
|
- unsigned castSize = Context.getTypeSize(castTy);
|
|
|
+ unsigned castSize = Context.getIntWidth(castTy);
|
|
|
if (castSize == LI->getNumBits())
|
|
|
return val;
|
|
|
return makeLocAsInteger(LI->getLoc(), castSize);
|
|
@@ -173,7 +170,7 @@ SVal SimpleSValBuilder::evalCastFromLoc(Loc val, QualType castTy) {
|
|
|
}
|
|
|
|
|
|
if (castTy->isIntegralOrEnumerationType()) {
|
|
|
- unsigned BitWidth = Context.getTypeSize(castTy);
|
|
|
+ unsigned BitWidth = Context.getIntWidth(castTy);
|
|
|
|
|
|
if (!val.getAs<loc::ConcreteInt>())
|
|
|
return makeLocAsInteger(val, BitWidth);
|