Home | History | Annotate | Download | only in Sema

Lines Matching refs:destType

48     CastOperation(Sema &S, QualType destType, ExprResult src)
49 : Self(S), SrcExpr(src), DestType(destType),
50 ResultType(destType.getNonLValueExprType(S.Context)),
51 ValueKind(Expr::getValueKindForType(destType)),
64 QualType DestType;
117 Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange);
124 if (Self.CheckObjCARCConversion(OpRange, DestType, src, CCK) ==
143 static bool CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
158 QualType DestType, bool CStyle,
163 QualType DestType, bool CStyle,
169 QualType DestType, bool CStyle,
175 CanQualType DestType, bool CStyle,
183 QualType DestType,bool CStyle,
190 QualType DestType,
196 QualType DestType,
202 static TryCastResult TryConstCast(Sema &Self, Expr *SrcExpr, QualType DestType,
205 QualType DestType, bool CStyle,
240 QualType DestType = DestTInfo->getType();
244 bool TypeDependent = DestType->isDependentType() || Ex.get()->isTypeDependent();
246 CastOperation Op(*this, DestType, E);
304 QualType destType,
321 if (!destType->isRecordType() && !srcType->isRecordType())
324 InitializedEntity entity = InitializedEntity::InitializeTemporary(destType);
369 << CT << srcType << destType
379 SourceRange opRange, Expr *src, QualType destType,
387 tryDiagnoseOverloadedCast(S, castType, opRange, src, destType,
392 << src->getType() << destType << opRange << src->getSourceRange();
452 /// DestType casts away constness as defined in C++ 5.2.11p8ff. This is used by
460 CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
475 assert((DestType->isAnyPointerType() || DestType->isMemberPointerType() ||
476 DestType->isBlockPointerType()) &&
480 UnwrappedDestType = Self.Context.getCanonicalType(DestType);
529 /// CheckDynamicCast - Check that a dynamic_cast\<DestType\>(SrcExpr) is valid.
541 QualType DestType = Self.Context.getCanonicalType(this->DestType);
547 const PointerType *DestPointer = DestType->getAs<PointerType>();
551 } else if ((DestReference = DestType->getAs<ReferenceType>())) {
555 << this->DestType << DestRange;
590 << CT_Dynamic << OrigSrcType << this->DestType << OpRange;
618 << CT_Dynamic << OrigSrcType << this->DestType << OpRange;
661 /// CheckConstCast - Check that a const_cast\<DestType\>(SrcExpr) is valid.
675 if (TryConstCast(Self, SrcExpr.get(), DestType, /*CStyle*/false, msg) != TC_Success
678 << SrcExpr.get()->getType() << DestType << OpRange;
681 /// CheckReinterpretCast - Check that a reinterpret_cast\<DestType\>(SrcExpr) is
696 TryReinterpretCast(Self, SrcExpr, DestType,
706 << DestType << OpRange;
711 DestType, /*listInitialization=*/false);
719 /// CheckStaticCast - Check that a static_cast\<DestType\>(SrcExpr) is valid.
732 if (DestType->isVoidType()) {
739 OpRange, DestType, diag::err_bad_static_cast_overload);
748 if (ValueKind == VK_RValue && !DestType->isRecordType() &&
757 = TryStaticCast(Self, SrcExpr, DestType, Sema::CCK_OtherCast, OpRange, msg,
765 << oe->getName() << DestType << OpRange
769 diagnoseBadCast(Self, msg, CT_Static, OpRange, SrcExpr.get(), DestType,
786 QualType DestType,
815 tcr = TryStaticReferenceDowncast(Self, SrcExpr.get(), DestType, CStyle,
823 tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind,
830 tcr = TryStaticImplicitCast(Self, SrcExpr, DestType, CCK, OpRange, msg,
852 if (DestType->isBooleanType()) {
855 } else if (DestType->isIntegralType(Self.Context)) {
858 } else if (DestType->isRealFloatingType()) {
873 if (DestType->isEnumeralType()) {
885 tcr = TryStaticPointerDowncast(Self, SrcType, DestType, CStyle, OpRange, msg,
893 tcr = TryStaticMemberPointerUpcast(Self, SrcExpr, SrcType, DestType, CStyle,
904 if (const PointerType *DestPointer = DestType->getAs<PointerType>()) {
927 else if (DestType->isObjCObjectPointerType()) {
933 else if (CStyle && DestType->isBlockPointerType()) {
942 DestType->isObjCObjectPointerType()) {
953 TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType,
959 const RValueReferenceType *R = DestType->getAs<RValueReferenceType>();
1004 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType,
1017 const ReferenceType *DestReference = DestType->getAs<ReferenceType>();
1033 OpRange, SrcExpr->getType(), DestType, msg, Kind,
1039 TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType,
1051 const PointerType *DestPointer = DestType->getAs<PointerType>();
1065 CStyle, OpRange, SrcType, DestType, msg, Kind,
1071 /// DestType is possible and allowed.
1073 TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType,
1079 Self.RequireCompleteType(OpRange.getBegin(), DestType, Self.PDiag(0)))
1083 if (!DestType->getAs<RecordType>() || !SrcType->getAs<RecordType>()) {
1089 if (!Self.IsDerivedFrom(DestType, SrcType, Paths)) {
1112 if (!CStyle && !DestType.isAtLeastAsQualifiedAs(SrcType)) {
1125 Self.IsDerivedFrom(DestType, SrcType, Paths);
1139 PathDisplayStr += QualType(DestType).getAsString();
1145 << QualType(DestType).getUnqualifiedType()
1161 SrcType, DestType,
1189 QualType DestType, bool CStyle,
1193 const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>();
1201 = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), DestType, false,
1273 DestType,
1299 TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType,
1303 if (DestType->isRecordType()) {
1304 if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
1311 InitializedEntity Entity = InitializedEntity::InitializeTemporary(DestType);
1329 if (InitSeq.Failed() && (CStyle || !DestType->isReferenceType()))
1350 static TryCastResult TryConstCast(Sema &Self, Expr *SrcExpr, QualType DestType,
1352 DestType = Self.Context.getCanonicalType(DestType);
1354 if (const ReferenceType *DestTypeTmp =DestType->getAs<ReferenceType>()) {
1365 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
1372 if (!DestType->isPointerType() &&
1373 !DestType->isMemberPointerType() &&
1374 !DestType->isObjCObjectPointerType()) {
1375 // Cannot cast to non-pointer, non-reference type. Note that, if DestType
1384 if (DestType->isFunctionPointerType() ||
1385 DestType->isMemberFunctionPointerType()) {
1400 while (SrcType != DestType &&
1401 Self.Context.UnwrapSimilarPointerTypes(SrcType, DestType)) {
1404 DestType = Self.Context.getUnqualifiedArrayType(DestType, DestQuals);
1415 if (SrcType != DestType)
1426 void Sema::CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
1440 if (!SrcType->getAs<PointerType>() || !DestType->getAs<PointerType>()) {
1444 DestTy = DestType->getPointeeType();
1446 if (!DestType->getAs<ReferenceType>()) {
1450 DestTy = DestType->getPointeeType();
1475 Diag(Range.getBegin(), DiagID) << SrcType << DestType << Range;
1479 QualType DestType, bool CStyle,
1485 DestType = Self.Context.getCanonicalType(DestType);
1497 Expr::getValueKindForType(DestType) == VK_RValue // Convert Fun to Ptr
1506 if (const ReferenceType *DestTypeTmp = DestType->getAs<ReferenceType>()) {
1516 Self.CheckCompatibleReinterpretCast(SrcType, DestType,
1536 << inappropriate << DestType
1543 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
1552 const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>(),
1567 if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle,
1587 if (SrcType->isNullPtrType() && DestType->isIntegralType(Self.Context)) {
1593 Self.Context.getTypeSize(DestType)) {
1601 bool destIsVector = DestType->isVectorType();
1606 bool destIsScalar = DestType->isIntegralType(Self.Context);
1615 == Self.Context.getTypeSize(DestType)) {
1630 if (SrcType == DestType) {
1650 bool destIsPtr = DestType->isAnyPointerType() ||
1651 DestType->isBlockPointerType();
1660 if (DestType->isIntegralType(Self.Context)) {
1666 Self.Context.getTypeSize(DestType)) &&
1693 if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle,
1700 if ((SrcType->isBlockPointerType() && DestType->isObjCObjectPointerType()) ||
1701 (DestType->isBlockPointerType() && SrcType->isObjCObjectPointerType()))
1706 } else if (DestType->isObjCObjectPointerType()) {
1708 } else if (DestType->isBlockPointerType()) {
1720 if (CStyle && DestType->isObjCObjectPointerType()) {
1728 if (DestType->isFunctionPointerType()) {
1747 if (DestType->isFunctionPointerType()) {
1770 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType,
1784 if (DestType->isVoidType()) {
1790 /* Complain */ true, DestRange, DestType,
1804 if (DestType->isDependentType() || SrcExpr.get()->isTypeDependent()) {
1809 if (ValueKind == VK_RValue && !DestType->isRecordType() &&
1817 if (const VectorType *vecTy = DestType->getAs<VectorType>())
1837 TryCastResult tcr = TryConstCast(Self, SrcExpr.get(), DestType,
1847 tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange,
1854 tcr = TryReinterpretCast(Self, SrcExpr, DestType, /*CStyle*/true,
1868 DestType,
1877 OpRange, SrcExpr.get(), DestType, ListInitialization);
1894 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType,
1902 if (DestType->isVoidType()) {
1924 if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
1930 if (!DestType->isScalarType() && !DestType->isVectorType()) {
1931 const RecordType *DestRecordTy = DestType->getAs<RecordType>();
1933 if (DestRecordTy && Self.Context.hasSameUnqualifiedType(DestType, SrcType)){
1936 << DestType << SrcExpr.get()->getSourceRange();
1966 << DestType << SrcExpr.get()->getSourceRange();
1982 if (DestType->isExtVectorType()) {
1983 SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.take(), Kind);
1987 if (const VectorType *DestVecTy = DestType->getAs<VectorType>()) {
1991 } else if (Self.CheckVectorCast(OpRange, DestType, SrcType, Kind)) {
1998 if (Self.CheckVectorCast(OpRange, SrcType, DestType, Kind))
2016 if (!DestType->isArithmeticType()) {
2025 if (!DestType->isIntegralType(Self.Context) &&
2026 DestType->isArithmeticType()) {
2029 << DestType << SrcExpr.get()->getSourceRange();
2041 if (const PointerType *CastPtr = DestType->getAs<PointerType>()) {
2050 << SrcType << DestType << Sema::AA_Casting
2056 else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) {
2059 << 1 << SrcType << DestType << SrcExpr.get()->getSourceRange();
2065 Kind = Self.PrepareScalarCast(SrcExpr, DestType);