Home | History | Annotate | Download | only in Sema

Lines Matching refs:DestType

50     CastOperation(Sema &S, QualType destType, ExprResult src)
51 : Self(S), SrcExpr(src), DestType(destType),
52 ResultType(destType.getNonLValueExprType(S.Context)),
53 ValueKind(Expr::getValueKindForType(destType)),
66 QualType DestType;
119 Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange);
126 if (Self.CheckObjCARCConversion(OpRange, DestType, src, CCK) ==
145 static bool CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
160 QualType DestType, bool CStyle,
165 QualType DestType, bool CStyle,
171 QualType DestType, bool CStyle,
177 CanQualType DestType, bool CStyle,
185 QualType DestType,bool CStyle,
192 QualType DestType,
198 QualType DestType,
205 QualType DestType, bool CStyle,
208 QualType DestType, bool CStyle,
243 QualType DestType = DestTInfo->getType();
247 bool TypeDependent = DestType->isDependentType() ||
251 CastOperation Op(*this, DestType, E);
313 QualType destType,
330 if (!destType->isRecordType() && !srcType->isRecordType())
333 InitializedEntity entity = InitializedEntity::InitializeTemporary(destType);
378 << CT << srcType << destType
388 SourceRange opRange, Expr *src, QualType destType,
391 tryDiagnoseOverloadedCast(S, castType, opRange, src, destType,
396 << src->getType() << destType << opRange << src->getSourceRange();
456 /// DestType casts away constness as defined in C++ 5.2.11p8ff. This is used by
464 CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
479 assert((DestType->isAnyPointerType() || DestType->isMemberPointerType() ||
480 DestType->isBlockPointerType()) &&
484 UnwrappedDestType = Self.Context.getCanonicalType(DestType);
533 /// CheckDynamicCast - Check that a dynamic_cast\<DestType\>(SrcExpr) is valid.
545 QualType DestType = Self.Context.getCanonicalType(this->DestType);
551 const PointerType *DestPointer = DestType->getAs<PointerType>();
555 } else if ((DestReference = DestType->getAs<ReferenceType>())) {
559 << this->DestType << DestRange;
599 << CT_Dynamic << OrigSrcType << this->DestType << OpRange;
635 << CT_Dynamic << OrigSrcType << this->DestType << OpRange;
691 /// CheckConstCast - Check that a const_cast\<DestType\>(SrcExpr) is valid.
705 if (TryConstCast(Self, SrcExpr, DestType, /*CStyle*/false, msg) != TC_Success
708 << SrcExpr.get()->getType() << DestType << OpRange;
713 /// Check that a reinterpret_cast\<DestType\>(SrcExpr) is not used as upcast
716 QualType DestType,
731 const CXXRecordDecl *DestRD = DestType->getPointeeCXXRecordDecl();
793 ReinterpretKind == ReinterpretUpcast? DestType : SrcType;
795 ReinterpretKind == ReinterpretUpcast? SrcType : DestType;
806 /// CheckReinterpretCast - Check that a reinterpret_cast\<DestType\>(SrcExpr) is
821 TryReinterpretCast(Self, SrcExpr, DestType,
831 << DestType << OpRange;
836 DestType, /*listInitialization=*/false);
842 DiagnoseReinterpretUpDownCast(Self, SrcExpr.get(), DestType, OpRange);
847 /// CheckStaticCast - Check that a static_cast\<DestType\>(SrcExpr) is valid.
860 if (DestType->isVoidType()) {
867 OpRange, DestType, diag::err_bad_static_cast_overload);
876 if (ValueKind == VK_RValue && !DestType->isRecordType() &&
885 = TryStaticCast(Self, SrcExpr, DestType, Sema::CCK_OtherCast, OpRange, msg,
893 << oe->getName() << DestType << OpRange
897 diagnoseBadCast(Self, msg, CT_Static, OpRange, SrcExpr.get(), DestType,
915 QualType DestType,
944 tcr = TryStaticReferenceDowncast(Self, SrcExpr.get(), DestType, CStyle,
952 tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind,
959 tcr = TryStaticImplicitCast(Self, SrcExpr, DestType, CCK, OpRange, msg,
981 if (DestType->isBooleanType()) {
984 } else if (DestType->isIntegralType(Self.Context)) {
987 } else if (DestType->isRealFloatingType()) {
1002 if (DestType->isEnumeralType()) {
1014 tcr = TryStaticPointerDowncast(Self, SrcType, DestType, CStyle, OpRange, msg,
1022 tcr = TryStaticMemberPointerUpcast(Self, SrcExpr, SrcType, DestType, CStyle,
1033 if (const PointerType *DestPointer = DestType->getAs<PointerType>()) {
1056 else if (DestType->isObjCObjectPointerType()) {
1062 else if (CStyle && DestType->isBlockPointerType()) {
1071 DestType->isObjCObjectPointerType()) {
1078 Self.CheckTollFreeBridgeStaticCast(DestType, SrcExpr.get(), Kind))
1087 TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType,
1093 const RValueReferenceType *R = DestType->getAs<RValueReferenceType>();
1138 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType,
1151 const ReferenceType *DestReference = DestType->getAs<ReferenceType>();
1170 OpRange, SrcExpr->getType(), DestType, msg, Kind,
1176 TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType,
1188 const PointerType *DestPointer = DestType->getAs<PointerType>();
1202 CStyle, OpRange, SrcType, DestType, msg, Kind,
1208 /// DestType is possible and allowed.
1210 TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType,
1216 Self.RequireCompleteType(OpRange.getBegin(), DestType, 0))
1220 if (!DestType->getAs<RecordType>() || !SrcType->getAs<RecordType>()) {
1226 DestType, SrcType, Paths)) {
1249 if (!CStyle && !DestType.isAtLeastAsQualifiedAs(SrcType)) {
1262 Self.IsDerivedFrom(DestType, SrcType, Paths);
1276 PathDisplayStr += QualType(DestType).getAsString();
1282 << QualType(DestType).getUnqualifiedType()
1298 SrcType, DestType,
1326 QualType DestType, bool CStyle,
1330 const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>();
1338 = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), DestType, false,
1411 DestType,
1437 TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType,
1441 if (DestType->isRecordType()) {
1442 if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
1444 Self.RequireNonAbstractType(OpRange.getBegin(), DestType,
1449 } else if (DestType->isMemberPointerType()) {
1451 Self.RequireCompleteType(OpRange.getBegin(), DestType, 0);
1455 InitializedEntity Entity = InitializedEntity::InitializeTemporary(DestType);
1473 if (InitSeq.Failed() && (CStyle || !DestType->isReferenceType()))
1494 QualType DestType, bool CStyle,
1496 DestType = Self.Context.getCanonicalType(DestType);
1500 if (const ReferenceType *DestTypeTmp =DestType->getAs<ReferenceType>()) {
1543 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
1550 if (!DestType->isPointerType() &&
1551 !DestType->isMemberPointerType() &&
1552 !DestType->isObjCObjectPointerType()) {
1553 // Cannot cast to non-pointer, non-reference type. Note that, if DestType
1562 if (DestType->isFunctionPointerType() ||
1563 DestType->isMemberFunctionPointerType()) {
1578 while (SrcType != DestType &&
1579 Self.Context.UnwrapSimilarPointerTypes(SrcType, DestType)) {
1582 DestType = Self.Context.getUnqualifiedArrayType(DestType, DestQuals);
1593 if (SrcType != DestType)
1610 void Sema::CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
1622 if (!SrcType->getAs<PointerType>() || !DestType->getAs<PointerType>()) {
1626 DestTy = DestType->getPointeeType();
1628 if (!DestType->getAs<ReferenceType>()) {
1632 DestTy = DestType->getPointeeType();
1657 Diag(Range.getBegin(), DiagID) << SrcType << DestType << Range;
1661 QualType DestType) {
1663 if (Self.Context.hasSameType(SrcType, DestType))
1667 QualType DT = DestType;
1668 if (isa<PointerType>(DestType))
1669 DT = DestType->getPointeeType();
1673 << SrcType << DestType << SrcExpr.get()->getSourceRange();
1678 const Expr *SrcExpr, QualType DestType,
1689 && Self.Context.getTypeSize(DestType) >
1696 unsigned Diag = DestType->isVoidPointerType() ?
1699 Self.Diag(Loc, Diag) << SrcType << DestType;
1704 QualType DestType, bool CStyle,
1710 DestType = Self.Context.getCanonicalType(DestType);
1722 Expr::getValueKindForType(DestType) == VK_RValue // Convert Fun to Ptr
1731 if (const ReferenceType *DestTypeTmp = DestType->getAs<ReferenceType>()) {
1740 Self.CheckCompatibleReinterpretCast(SrcType, DestType,
1760 << inappropriate << DestType
1767 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
1776 const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>(),
1791 if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle,
1801 Self.RequireCompleteType(OpRange.getBegin(), DestType, 0);
1818 if (SrcType->isNullPtrType() && DestType->isIntegralType(Self.Context)) {
1824 Self.Context.getTypeSize(DestType)) {
1832 bool destIsVector = DestType->isVectorType();
1837 bool destIsScalar = DestType->isIntegralType(Self.Context);
1846 == Self.Context.getTypeSize(DestType)) {
1861 if (SrcType == DestType) {
1881 bool destIsPtr = DestType->isAnyPointerType() ||
1882 DestType->isBlockPointerType();
1891 if (DestType->isIntegralType(Self.Context)) {
1897 !DestType->isBooleanType();
1899 Self.Context.getTypeSize(DestType)) &&
1910 checkIntToPointerCast(CStyle, OpRange.getBegin(), SrcExpr.get(), DestType,
1928 if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle,
1935 if ((SrcType->isBlockPointerType() && DestType->isObjCObjectPointerType()) ||
1936 (DestType->isBlockPointerType() && SrcType->isObjCObjectPointerType()))
1941 } else if (DestType->isObjCObjectPointerType()) {
1943 } else if (DestType->isBlockPointerType()) {
1955 if (CStyle && DestType->isObjCObjectPointerType()) {
1959 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType);
1965 if (DestType->isFunctionPointerType()) {
1984 if (DestType->isFunctionPointerType()) {
2007 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType,
2021 if (DestType->isVoidType()) {
2027 /* Complain */ true, DestRange, DestType,
2038 if (DestType->isDependentType() || SrcExpr.get()->isTypeDependent() ||
2044 if (ValueKind == VK_RValue && !DestType->isRecordType() &&
2052 if (const VectorType *vecTy = DestType->getAs<VectorType>())
2072 TryCastResult tcr = TryConstCast(Self, SrcExpr, DestType,
2084 tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange,
2091 tcr = TryReinterpretCast(Self, SrcExpr, DestType, /*CStyle*/true,
2105 DestType,
2109 // If DestType is a function type (not to be confused with the function
2114 << OE->getName() << DestType << OpRange
2120 OpRange, SrcExpr.get(), DestType, ListInitialization);
2135 QualType DestType) {
2144 if (DestType.getUnqualifiedType()->isVoidType())
2147 && (DestType->isAnyPointerType() || DestType->isBlockPointerType()))
2149 if (SrcType->isIntegerType() && DestType->isIntegerType() &&
2150 (SrcType->isBooleanType() == DestType->isBooleanType()) &&
2151 (SrcType->isEnumeralType() == DestType->isEnumeralType()))
2153 if (SrcType->isRealFloatingType() && DestType->isRealFloatingType())
2155 if (SrcType->isEnumeralType() && DestType->isEnumeralType())
2157 if (SrcType->isComplexType() && DestType->isComplexType())
2159 if (SrcType->isComplexIntegerType() && DestType->isComplexIntegerType())
2164 << SrcType << DestType << SrcExpr.get()->getSourceRange();
2173 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType,
2181 if (DestType->isVoidType()) {
2201 if (Self.getLangOpts().OpenCL && DestType->isPointerType() &&
2203 if (DestType->getPointeeType().getAddressSpace() !=
2207 << SrcType << DestType << Sema::AA_Casting
2214 if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
2220 if (!DestType->isScalarType() && !DestType->isVectorType()) {
2221 const RecordType *DestRecordTy = DestType->getAs<RecordType>();
2223 if (DestRecordTy && Self.Context.hasSameUnqualifiedType(DestType, SrcType)){
2226 << DestType << SrcExpr.get()->getSourceRange();
2256 << DestType << SrcExpr.get()->getSourceRange();
2272 if (DestType->isExtVectorType()) {
2273 SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.get(), Kind);
2277 if (const VectorType *DestVecTy = DestType->getAs<VectorType>()) {
2281 } else if (Self.CheckVectorCast(OpRange, DestType, SrcType, Kind)) {
2288 if (Self.CheckVectorCast(OpRange, SrcType, DestType, Kind))
2306 if (!DestType->isArithmeticType()) {
2315 DestType, Self);
2317 if (!DestType->isIntegralType(Self.Context) &&
2318 DestType->isArithmeticType()) {
2321 << DestType << SrcExpr.get()->getSourceRange();
2328 if (DestType->isHalfType()) {
2330 << DestType << SrcExpr.get()->getSourceRange();
2342 if (const PointerType *CastPtr = DestType->getAs<PointerType>()) {
2351 << SrcType << DestType << Sema::AA_Casting
2357 else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) {
2360 << 1 << SrcType << DestType << SrcExpr.get()->getSourceRange();
2366 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType);
2367 DiagnoseBadFunctionCast(Self, SrcExpr, DestType);
2368 Kind = Self.PrepareScalarCast(SrcExpr, DestType);