Lines Matching defs:CastTy

549 /// \param CastTy -- QualType that V should be casted according to.
556 /// FIXME: If `OriginalTy.isNull()` is true, then cast performs based on CastTy
558 SVal SValBuilder::evalCast(SVal V, QualType CastTy, QualType OriginalTy) {
559 if (CastTy.isNull())
562 CastTy = Context.getCanonicalType(CastTy);
568 if (CastTy == OriginalTy)
574 if (!CastTy->isVariableArrayType() && !OriginalTy->isVariableArrayType())
575 if (shouldBeModeledWithNoOp(Context, Context.getPointerType(CastTy),
583 return evalCastKind(V.castAs<UndefinedVal>(), CastTy, OriginalTy);
585 return evalCastKind(V.castAs<UnknownVal>(), CastTy, OriginalTy);
587 return evalCastKind(V.castAs<Loc>(), CastTy, OriginalTy);
589 return evalCastKind(V.castAs<NonLoc>(), CastTy, OriginalTy);
595 SVal SValBuilder::evalCastKind(UndefinedVal V, QualType CastTy,
600 SVal SValBuilder::evalCastKind(UnknownVal V, QualType CastTy,
605 SVal SValBuilder::evalCastKind(Loc V, QualType CastTy, QualType OriginalTy) {
608 return evalCastSubKind(V.castAs<loc::ConcreteInt>(), CastTy, OriginalTy);
610 return evalCastSubKind(V.castAs<loc::GotoLabel>(), CastTy, OriginalTy);
612 return evalCastSubKind(V.castAs<loc::MemRegionVal>(), CastTy, OriginalTy);
618 SVal SValBuilder::evalCastKind(NonLoc V, QualType CastTy, QualType OriginalTy) {
621 return evalCastSubKind(V.castAs<nonloc::CompoundVal>(), CastTy, OriginalTy);
623 return evalCastSubKind(V.castAs<nonloc::ConcreteInt>(), CastTy, OriginalTy);
625 return evalCastSubKind(V.castAs<nonloc::LazyCompoundVal>(), CastTy,
628 return evalCastSubKind(V.castAs<nonloc::LocAsInteger>(), CastTy,
631 return evalCastSubKind(V.castAs<nonloc::SymbolVal>(), CastTy, OriginalTy);
633 return evalCastSubKind(V.castAs<nonloc::PointerToMember>(), CastTy,
640 SVal SValBuilder::evalCastSubKind(loc::ConcreteInt V, QualType CastTy,
643 if (CastTy->isBooleanType())
644 return makeTruthVal(V.getValue().getBoolValue(), CastTy);
647 if (CastTy->isIntegralOrEnumerationType()) {
649 BasicVals.getAPSIntType(CastTy).apply(Value);
654 if (Loc::isLocType(CastTy))
661 SVal SValBuilder::evalCastSubKind(loc::GotoLabel V, QualType CastTy,
664 if (CastTy->isBooleanType())
666 return makeTruthVal(true, CastTy);
669 if (CastTy->isIntegralOrEnumerationType()) {
670 const unsigned BitWidth = Context.getIntWidth(CastTy);
678 if (CastTy->isPointerType() || CastTy->isReferenceType())
683 if (Loc::isLocType(CastTy))
695 SVal SValBuilder::evalCastSubKind(loc::MemRegionVal V, QualType CastTy,
698 if (CastTy->isBooleanType()) {
710 BasicVals.getZeroWithPtrWidth(), CastTy);
712 return makeTruthVal(true, CastTy);
723 if (CastTy->isIntegralOrEnumerationType()) {
735 const unsigned BitWidth = Context.getIntWidth(CastTy);
740 if (Loc::isLocType(CastTy)) {
752 if (CastTy->isPointerType() && !CastTy->isVoidPointerType()) {
755 if (!hasSameUnqualifiedPointeeType(SRTy, CastTy)) {
756 R = StateMgr.getStoreManager().castRegion(SR, CastTy);
764 if ((R = StateMgr.getStoreManager().castRegion(ER, CastTy)))
779 if (CastTy->isPointerType() || CastTy->isReferenceType()) {
786 assert(CastTy->isIntegralOrEnumerationType());
791 CastTy->isReferenceType());
810 if ((R = StateMgr.getStoreManager().castRegion(R, CastTy)))
826 SVal SValBuilder::evalCastSubKind(nonloc::CompoundVal V, QualType CastTy,
832 SVal SValBuilder::evalCastSubKind(nonloc::ConcreteInt V, QualType CastTy,
834 auto CastedValue = [V, CastTy, this]() {
836 BasicVals.getAPSIntType(CastTy).apply(Value);
841 if (CastTy->isBooleanType())
842 return makeTruthVal(V.getValue().getBoolValue(), CastTy);
845 if (CastTy->isIntegralOrEnumerationType())
849 if (Loc::isLocType(CastTy))
856 SVal SValBuilder::evalCastSubKind(nonloc::LazyCompoundVal V, QualType CastTy,
862 SVal SValBuilder::evalCastSubKind(nonloc::LocAsInteger V, QualType CastTy,
867 if (CastTy->isBooleanType())
869 return evalCastKind(L, CastTy, OriginalTy);
873 if (!IsUnknownOriginalType && Loc::isLocType(CastTy) &&
876 if ((R = StateMgr.getStoreManager().castRegion(R, CastTy)))
884 if (CastTy->isIntegralOrEnumerationType())
885 return evalCastSubKind(loc::MemRegionVal(R), CastTy, OriginalTy);
887 if (Loc::isLocType(CastTy)) {
889 CastTy->isReferenceType());
893 if ((R = StateMgr.getStoreManager().castRegion(R, CastTy)))
897 if (Loc::isLocType(CastTy)) {
899 return evalCastSubKind(loc::MemRegionVal(R), CastTy, OriginalTy);
911 if (!CastTy->isFloatingType() || !SE || SE->getType()->isFloatingType()) {
913 const unsigned CastSize = Context.getIntWidth(CastTy);
925 SVal SValBuilder::evalCastSubKind(nonloc::SymbolVal V, QualType CastTy,
931 if (!IsUnknownOriginalType && CastTy->isBooleanType()) {
937 return makeNonLoc(SE, BO_NE, BVF.getValue(0, SE->getType()), CastTy);
949 if (haveSameType(T, CastTy))
951 if (!Loc::isLocType(CastTy))
952 if (!IsUnknownOriginalType || !CastTy->isFloatingType() ||
954 return makeNonLoc(SE, T, CastTy);
961 SVal SValBuilder::evalCastSubKind(nonloc::PointerToMember V, QualType CastTy,