Lines Matching refs:Self

59       : Self(S), SrcExpr(src), DestType(destType),  in CastOperation()
81 Sema &Self; member
119 Self.Context, Self.Context.ARCUnbridgedCastTy, CK_Dependent, in complete()
121 Self.CurFPFeatureOverrides()); in complete()
150 Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange); in checkCastAlign()
154 assert(Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()); in checkObjCConversion()
157 if (Self.CheckObjCConversion(OpRange, DestType, src, CCK) == in checkObjCConversion()
168 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in checkNonOverloadPlaceholders()
192 CheckNoDeref(Op.Self, Op.SrcExpr.get()->getType(), Op.ResultType, in ~CheckNoDerefRAII()
200 static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr,
214 static TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr,
219 static TryCastResult TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr,
225 static TryCastResult TryStaticPointerDowncast(Sema &Self, QualType SrcType,
231 static TryCastResult TryStaticDowncast(Sema &Self, CanQualType SrcType,
238 static TryCastResult TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr,
246 static TryCastResult TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr,
252 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
259 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr,
262 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
266 static TryCastResult TryAddressSpaceCast(Sema &Self, ExprResult &SrcExpr,
638 CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, in CastsAwayConstness() argument
645 if (!CheckCVR && CheckObjCLifetime && !Self.Context.getLangOpts().ObjC) in CastsAwayConstness()
657 QualType UnwrappedSrcType = Self.Context.getCanonicalType(SrcType), in CastsAwayConstness()
658 UnwrappedDestType = Self.Context.getCanonicalType(DestType); in CastsAwayConstness()
668 Self.Context, UnwrappedSrcType, UnwrappedDestType)) { in CastsAwayConstness()
676 Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals); in CastsAwayConstness()
677 Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals); in CastsAwayConstness()
760 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckDynamicCast()
762 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in CheckDynamicCast()
767 QualType DestType = Self.Context.getCanonicalType(this->DestType); in CheckDynamicCast()
780 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ref_or_ptr) in CheckDynamicCast()
790 if (Self.RequireCompleteType(OpRange.getBegin(), DestPointee, in CheckDynamicCast()
797 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) in CheckDynamicCast()
807 QualType SrcType = Self.Context.getCanonicalType(OrigSrcType); in CheckDynamicCast()
813 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ptr) in CheckDynamicCast()
820 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue) in CheckDynamicCast()
828 SrcExpr = Self.CreateMaterializeTemporaryExpr( in CheckDynamicCast()
835 if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee, in CheckDynamicCast()
842 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) in CheckDynamicCast()
856 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_qualifiers_away) in CheckDynamicCast()
872 Self.IsDerivedFrom(OpRange.getBegin(), SrcPointee, DestPointee)) { in CheckDynamicCast()
873 if (Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee, in CheckDynamicCast()
888 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic) in CheckDynamicCast()
896 if (!Self.getLangOpts().RTTI && !DestPointee->isVoidType()) { in CheckDynamicCast()
897 Self.Diag(OpRange.getBegin(), diag::err_no_dynamic_cast_with_fno_rtti); in CheckDynamicCast()
903 if (!Self.getLangOpts().RTTIData) { in CheckDynamicCast()
905 Self.getASTContext().getTargetInfo().getCXXABI().isMicrosoft(); in CheckDynamicCast()
906 bool isClangCL = Self.getDiagnostics().getDiagnosticOptions().getFormat() == in CheckDynamicCast()
909 Self.Diag(OpRange.getBegin(), in CheckDynamicCast()
927 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckConstCast()
929 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in CheckConstCast()
934 auto TCR = TryConstCast(Self, SrcExpr, DestType, /*CStyle*/ false, msg); in CheckConstCast()
936 Self.Diag(OpRange.getBegin(), msg) << CT_Const in CheckConstCast()
946 TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ false, msg, Kind); in CheckAddrspaceCast()
948 Self.Diag(OpRange.getBegin(), msg) in CheckAddrspaceCast()
957 static void DiagnoseReinterpretUpDownCast(Sema &Self, const Expr *SrcExpr, in DiagnoseReinterpretUpDownCast() argument
1016 Self.Context.getASTRecordLayout(Class); in DiagnoseReinterpretUpDownCast()
1040 Self.Diag(BeginLoc, diag::warn_reinterpret_different_from_static) in DiagnoseReinterpretUpDownCast()
1043 Self.Diag(BeginLoc, diag::note_reinterpret_updowncast_use_static) in DiagnoseReinterpretUpDownCast()
1062 static bool checkCastFunctionType(Sema &Self, const ExprResult &SrcExpr, in checkCastFunctionType() argument
1064 if (Self.Diags.isIgnored(diag::warn_cast_function_type, in checkCastFunctionType()
1099 Self.Context)) in checkCastFunctionType()
1126 DstFPTy->getParamType(i), Self.Context)) in checkCastFunctionType()
1139 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckReinterpretCast()
1147 TryReinterpretCast(Self, SrcExpr, DestType, in CheckReinterpretCast()
1152 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckReinterpretCast()
1154 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_overload) in CheckReinterpretCast()
1157 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckReinterpretCast()
1160 diagnoseBadCast(Self, msg, CT_Reinterpret, OpRange, SrcExpr.get(), in CheckReinterpretCast()
1166 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) in CheckReinterpretCast()
1168 DiagnoseReinterpretUpDownCast(Self, SrcExpr.get(), DestType, OpRange); in CheckReinterpretCast()
1170 if (!checkCastFunctionType(Self, SrcExpr, DestType)) in CheckReinterpretCast()
1171 Self.Diag(OpRange.getBegin(), diag::warn_cast_function_type) in CheckReinterpretCast()
1198 Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr, in CheckStaticCast()
1206 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckStaticCast()
1212 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckStaticCast()
1219 = TryStaticCast(Self, SrcExpr, DestType, Sema::CCK_OtherCast, OpRange, msg, in CheckStaticCast()
1224 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckStaticCast()
1226 Self.Diag(OpRange.getBegin(), diag::err_bad_static_cast_overload) in CheckStaticCast()
1229 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckStaticCast()
1231 diagnoseBadCast(Self, msg, CT_Static, OpRange, SrcExpr.get(), DestType, in CheckStaticCast()
1239 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) in CheckStaticCast()
1260 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr, in TryStaticCast() argument
1290 tcr = TryStaticReferenceDowncast(Self, SrcExpr.get(), DestType, CStyle, in TryStaticCast()
1298 tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind, in TryStaticCast()
1305 tcr = TryStaticImplicitCast(Self, SrcExpr, DestType, CCK, OpRange, msg, in TryStaticCast()
1322 QualType SrcType = Self.Context.getCanonicalType(SrcExpr.get()->getType()); in TryStaticCast()
1332 } else if (DestType->isIntegralType(Self.Context)) { in TryStaticCast()
1351 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in TryStaticCast()
1373 tcr = TryStaticPointerDowncast(Self, SrcType, DestType, CStyle, OpRange, msg, in TryStaticCast()
1381 tcr = TryStaticMemberPointerUpcast(Self, SrcExpr, SrcType, DestType, CStyle, in TryStaticCast()
1419 if (!CStyle && Self.getLangOpts().MSVCCompat && in TryStaticCast()
1421 Self.Diag(OpRange.getBegin(), diag::ext_ms_cast_fn_obj) << OpRange; in TryStaticCast()
1448 Self.CheckTollFreeBridgeStaticCast(DestType, SrcExpr.get(), Kind)) in TryStaticCast()
1460 if (Self.CheckMatrixCast(OpRange, DestType, SrcType, Kind)) { in TryStaticCast()
1472 TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, in TryLValueToRValueCast() argument
1497 Sema::ReferenceCompareResult RefResult = Self.CompareReferenceRelationship( in TryLValueToRValueCast()
1514 if (!Self.IsDerivedFrom(SrcExpr->getBeginLoc(), SrcExpr->getType(), in TryLValueToRValueCast()
1518 Self.BuildBasePathArray(Paths, BasePath); in TryLValueToRValueCast()
1527 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType, in TryStaticReferenceDowncast() argument
1556 return TryStaticDowncast(Self, in TryStaticReferenceDowncast()
1557 Self.Context.getCanonicalType(SrcExpr->getType()), in TryStaticReferenceDowncast()
1558 Self.Context.getCanonicalType(DestPointee), CStyle, in TryStaticReferenceDowncast()
1565 TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType, in TryStaticPointerDowncast() argument
1588 return TryStaticDowncast(Self, in TryStaticPointerDowncast()
1589 Self.Context.getCanonicalType(SrcPointer->getPointeeType()), in TryStaticPointerDowncast()
1590 Self.Context.getCanonicalType(DestPointer->getPointeeType()), in TryStaticPointerDowncast()
1599 TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType, in TryStaticDowncast() argument
1604 if (!Self.isCompleteType(OpRange.getBegin(), SrcType) || in TryStaticDowncast()
1605 !Self.isCompleteType(OpRange.getBegin(), DestType)) in TryStaticDowncast()
1615 if (!Self.IsDerivedFrom(OpRange.getBegin(), DestType, SrcType, Paths)) { in TryStaticDowncast()
1651 Self.IsDerivedFrom(OpRange.getBegin(), DestType, SrcType, Paths); in TryStaticDowncast()
1666 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_base_to_derived_cast) in TryStaticDowncast()
1676 Self.Diag(OpRange.getBegin(), diag::err_static_downcast_via_virtual) in TryStaticDowncast()
1683 switch (Self.CheckBaseClassAccess(OpRange.getBegin(), in TryStaticDowncast()
1698 Self.BuildBasePathArray(Paths, BasePath); in TryStaticDowncast()
1711 TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType, in TryStaticMemberPointerUpcast() argument
1722 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in TryStaticMemberPointerUpcast()
1724 = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), DestType, false, in TryStaticMemberPointerUpcast()
1727 SrcType = Self.Context.getMemberPointerType(Fn->getType(), in TryStaticMemberPointerUpcast()
1728 Self.Context.getTypeDeclType(M->getParent()).getTypePtr()); in TryStaticMemberPointerUpcast()
1741 if (Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) { in TryStaticMemberPointerUpcast()
1742 (void)Self.isCompleteType(OpRange.getBegin(), SrcType); in TryStaticMemberPointerUpcast()
1743 (void)Self.isCompleteType(OpRange.getBegin(), DestType); in TryStaticMemberPointerUpcast()
1747 if (!Self.Context.hasSameUnqualifiedType(SrcMemPtr->getPointeeType(), in TryStaticMemberPointerUpcast()
1756 if (!Self.IsDerivedFrom(OpRange.getBegin(), SrcClass, DestClass, Paths)) in TryStaticMemberPointerUpcast()
1760 if (Paths.isAmbiguous(Self.Context.getCanonicalType(DestClass))) { in TryStaticMemberPointerUpcast()
1764 Self.IsDerivedFrom(OpRange.getBegin(), SrcClass, DestClass, Paths); in TryStaticMemberPointerUpcast()
1767 std::string PathDisplayStr = Self.getAmbiguousPathsDisplayString(Paths); in TryStaticMemberPointerUpcast()
1768 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_memptr_conv) in TryStaticMemberPointerUpcast()
1775 Self.Diag(OpRange.getBegin(), diag::err_memptr_conv_via_virtual) in TryStaticMemberPointerUpcast()
1782 switch (Self.CheckBaseClassAccess(OpRange.getBegin(), in TryStaticMemberPointerUpcast()
1802 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in TryStaticMemberPointerUpcast()
1811 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr, FoundOverload, Fn); in TryStaticMemberPointerUpcast()
1818 Self.BuildBasePathArray(Paths, BasePath); in TryStaticMemberPointerUpcast()
1829 TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, in TryStaticImplicitCast() argument
1834 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in TryStaticImplicitCast()
1836 Self.RequireNonAbstractType(OpRange.getBegin(), DestType, in TryStaticImplicitCast()
1855 InitializationSequence InitSeq(Self, Entity, InitKind, SrcExprRaw); in TryStaticImplicitCast()
1867 ExprResult Result = InitSeq.Perform(Self, Entity, InitKind, SrcExprRaw); in TryStaticImplicitCast()
1884 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr, in TryConstCast() argument
1887 DestType = Self.Context.getCanonicalType(DestType); in TryConstCast()
1934 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType()); in TryConstCast()
1935 SrcType = Self.Context.getPointerType(SrcType); in TryConstCast()
1969 if (!Self.Context.hasCvrSimilarType(SrcType, DestType)) in TryConstCast()
1975 SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcExpr.get()->getType(), in TryConstCast()
2037 static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastOfObjCSEL() argument
2040 if (Self.Context.hasSameType(SrcType, DestType)) in DiagnoseCastOfObjCSEL()
2048 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseCastOfObjCSEL()
2056 static void DiagnoseCallingConvCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCallingConvCast() argument
2061 if (Self.Context.hasSameType(SrcType, DstType) || in DiagnoseCallingConvCast()
2090 CallingConv DefaultCC = Self.getASTContext().getDefaultCallingConvention( in DiagnoseCallingConvCast()
2098 Self.Diag(OpRange.getBegin(), diag::warn_cast_calling_conv) in DiagnoseCallingConvCast()
2104 if (Self.Diags.isIgnored(diag::warn_cast_calling_conv, OpRange.getBegin())) in DiagnoseCallingConvCast()
2112 Preprocessor &PP = Self.getPreprocessor(); in DiagnoseCallingConvCast()
2116 if (Self.getLangOpts().MicrosoftExt) { in DiagnoseCallingConvCast()
2120 AttrTokens.push_back(II->isKeyword(Self.getLangOpts()) in DiagnoseCallingConvCast()
2130 AttrTokens.push_back(II->isKeyword(Self.getLangOpts()) in DiagnoseCallingConvCast()
2140 Self.Diag(NameLoc, diag::note_change_calling_conv_fixit) in DiagnoseCallingConvCast()
2146 Sema &Self) { in checkIntToPointerCast() argument
2152 if (CStyle && SrcType->isIntegralType(Self.Context) in checkIntToPointerCast()
2155 && !SrcExpr->isIntegerConstantExpr(Self.Context) in checkIntToPointerCast()
2156 && Self.Context.getTypeSize(DestType) > in checkIntToPointerCast()
2157 Self.Context.getTypeSize(SrcType)) { in checkIntToPointerCast()
2166 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in checkIntToPointerCast()
2170 static bool fixOverloadedReinterpretCastExpr(Sema &Self, QualType DestType, in fixOverloadedReinterpretCastExpr() argument
2181 if (Self.ResolveAndFixSingleFunctionTemplateSpecialization( in fixOverloadedReinterpretCastExpr()
2192 if (!Self.resolveAndFixAddressOfSingleOverloadCandidate( in fixOverloadedReinterpretCastExpr()
2198 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, in TryReinterpretCast() argument
2205 DestType = Self.Context.getCanonicalType(DestType); in TryReinterpretCast()
2210 if (SrcType == Self.Context.OverloadTy) { in TryReinterpretCast()
2212 if (!fixOverloadedReinterpretCastExpr(Self, DestType, FixedExpr)) in TryReinterpretCast()
2229 Self.CheckCompatibleReinterpretCast(SrcType, DestType, in TryReinterpretCast()
2254 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_reference) in TryReinterpretCast()
2262 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType()); in TryReinterpretCast()
2263 SrcType = Self.Context.getPointerType(SrcType); in TryReinterpretCast()
2269 SrcType = Self.Context.getCanonicalType(SrcType); in TryReinterpretCast()
2282 if (Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) { in TryReinterpretCast()
2285 (void)Self.isCompleteType(OpRange.getBegin(), SrcType); in TryReinterpretCast()
2286 (void)Self.isCompleteType(OpRange.getBegin(), DestType); in TryReinterpretCast()
2290 if (Self.Context.getTypeSize(DestMemPtr) != in TryReinterpretCast()
2291 Self.Context.getTypeSize(SrcMemPtr)) { in TryReinterpretCast()
2301 CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle, in TryReinterpretCast()
2312 if (SrcType->isNullPtrType() && DestType->isIntegralType(Self.Context)) { in TryReinterpretCast()
2317 if (Self.Context.getTypeSize(SrcType) > in TryReinterpretCast()
2318 Self.Context.getTypeSize(DestType)) { in TryReinterpretCast()
2332 if (Self.isValidSveBitcast(SrcType, DestType)) { in TryReinterpretCast()
2340 if ((!destIsVector && !DestType->isIntegralType(Self.Context)) || in TryReinterpretCast()
2341 (!srcIsVector && !SrcType->isIntegralType(Self.Context))) in TryReinterpretCast()
2346 if (Self.areLaxCompatibleVectorTypes(SrcType, DestType)) { in TryReinterpretCast()
2351 if (Self.LangOpts.OpenCL && !CStyle) { in TryReinterpretCast()
2354 if (Self.areVectorTypesSameSize(SrcType, DestType)) { in TryReinterpretCast()
2402 if (DestType->isIntegralType(Self.Context)) { in TryReinterpretCast()
2407 if ((Self.Context.getTypeSize(SrcType) > in TryReinterpretCast()
2408 Self.Context.getTypeSize(DestType))) { in TryReinterpretCast()
2410 Self.getLangOpts().MicrosoftExt && !DestType->isBooleanType(); in TryReinterpretCast()
2415 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in TryReinterpretCast()
2427 checkIntToPointerCast(CStyle, OpRange, SrcExpr.get(), DestType, Self); in TryReinterpretCast()
2451 CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle, in TryReinterpretCast()
2466 Kind = Self.PrepareCastToObjCObjectPointer(SrcExpr); in TryReinterpretCast()
2483 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in TryReinterpretCast()
2485 DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange); in TryReinterpretCast()
2503 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2504 Self.getLangOpts().CPlusPlus11 ? in TryReinterpretCast()
2512 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2513 Self.getLangOpts().CPlusPlus11 ? in TryReinterpretCast()
2528 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2545 static TryCastResult TryAddressSpaceCast(Sema &Self, ExprResult &SrcExpr, in TryAddressSpaceCast() argument
2548 if (!Self.getLangOpts().OpenCL && !Self.getLangOpts().SYCLIsDevice) in TryAddressSpaceCast()
2572 Self.Context.removeAddrSpaceQualType(SrcPointeeType.getCanonicalType()); in TryAddressSpaceCast()
2574 Self.Context.removeAddrSpaceQualType(DestPointeeType.getCanonicalType()); in TryAddressSpaceCast()
2575 if (Self.Context.hasSameType(SrcPointeeTypeWithoutAS, in TryAddressSpaceCast()
2598 if (Self.getLangOpts().OpenCL) { in checkAddressSpaceCast()
2602 DestPtr = Self.getASTContext().getCanonicalType(DestType.getTypePtr()), in checkAddressSpaceCast()
2603 SrcPtr = Self.getASTContext().getCanonicalType(SrcType.getTypePtr()); in checkAddressSpaceCast()
2613 Self.Diag(OpRange.getBegin(), DiagID) in checkAddressSpaceCast()
2657 assert(Self.getLangOpts().CPlusPlus); in CheckCXXCStyleCast()
2663 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCXXCStyleCast()
2681 Self.ResolveAndFixSingleFunctionTemplateSpecialization( in CheckCXXCStyleCast()
2689 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckCXXCStyleCast()
2702 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckCXXCStyleCast()
2709 if (Self.CheckAltivecInitFromScalar(OpRange, DestType, in CheckCXXCStyleCast()
2714 if (Self.ShouldSplatAltivecScalarInCast(vecTy) && in CheckCXXCStyleCast()
2718 SrcExpr = Self.prepareVectorSplat(DestType, SrcExpr.get()); in CheckCXXCStyleCast()
2736 TryCastResult tcr = TryConstCast(Self, SrcExpr, DestType, in CheckCXXCStyleCast()
2746 tcr = TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ true, msg, in CheckCXXCStyleCast()
2754 tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange, msg, Kind, in CheckCXXCStyleCast()
2761 tcr = TryReinterpretCast(Self, SrcExpr, DestType, /*CStyle*/ true, in CheckCXXCStyleCast()
2769 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() && in CheckCXXCStyleCast()
2774 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCXXCStyleCast()
2776 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in CheckCXXCStyleCast()
2785 Self.Diag(OpRange.getBegin(), diag::err_bad_cstyle_cast_overload) in CheckCXXCStyleCast()
2788 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckCXXCStyleCast()
2791 diagnoseBadCast(Self, msg, (FunctionalStyle ? CT_Functional : CT_CStyle), in CheckCXXCStyleCast()
2800 if (!checkCastFunctionType(Self, SrcExpr, DestType)) in CheckCXXCStyleCast()
2801 Self.Diag(OpRange.getBegin(), diag::warn_cast_function_type) in CheckCXXCStyleCast()
2812 static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseBadFunctionCast() argument
2814 if (Self.Diags.isIgnored(diag::warn_bad_function_cast, in DiagnoseBadFunctionCast()
2842 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseBadFunctionCast()
2849 assert(!Self.getLangOpts().CPlusPlus); in CheckCStyleCast()
2853 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCStyleCast()
2863 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckCStyleCast()
2873 if (Self.getASTContext().isDependenceAllowed() && in CheckCStyleCast()
2884 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCStyleCast()
2886 if (FunctionDecl *FD = Self.ResolveAddressOfOverloadedFunction( in CheckCStyleCast()
2888 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr.get(), DAP, FD); in CheckCStyleCast()
2893 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckCStyleCast()
2904 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in CheckCStyleCast()
2912 Self.Context.hasSameUnqualifiedType(DestType, SrcType)) { in CheckCStyleCast()
2919 Self.isValidSveBitcast(SrcType, DestType)) { in CheckCStyleCast()
2928 if (DestRecordTy && Self.Context.hasSameUnqualifiedType(DestType, SrcType)){ in CheckCStyleCast()
2930 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_nonscalar) in CheckCStyleCast()
2940 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union) in CheckCStyleCast()
2945 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cast_to_union_no_type) in CheckCStyleCast()
2953 if (Self.getLangOpts().OpenCL && DestType->isEventT()) { in CheckCStyleCast()
2955 if (SrcExpr.get()->EvaluateAsInt(Result, Self.Context)) { in CheckCStyleCast()
2961 Self.Diag(OpRange.getBegin(), in CheckCStyleCast()
2970 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cond_expect_scalar) in CheckCStyleCast()
2981 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
2989 SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.get(), Kind); in CheckCStyleCast()
2994 if (Self.CheckMatrixCast(OpRange, DestType, SrcType, Kind)) in CheckCStyleCast()
3000 if (Self.CheckAltivecInitFromScalar(OpRange, DestType, SrcType)) { in CheckCStyleCast()
3004 if (Self.ShouldSplatAltivecScalarInCast(DestVecTy) && in CheckCStyleCast()
3007 SrcExpr = Self.prepareVectorSplat(DestType, SrcExpr.get()); in CheckCStyleCast()
3008 } else if (Self.CheckVectorCast(OpRange, DestType, SrcType, Kind)) { in CheckCStyleCast()
3015 if (Self.CheckVectorCast(OpRange, SrcType, DestType, Kind)) in CheckCStyleCast()
3026 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_selector_expr); in CheckCStyleCast()
3033 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_to_bfloat16) in CheckCStyleCast()
3039 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_from_bfloat16) in CheckCStyleCast()
3048 if (!SrcType->isIntegralType(Self.Context) && SrcType->isArithmeticType()) { in CheckCStyleCast()
3049 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
3056 Self); in CheckCStyleCast()
3058 if (!DestType->isIntegralType(Self.Context) && in CheckCStyleCast()
3060 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3067 if ((Self.Context.getTypeSize(SrcType) > in CheckCStyleCast()
3068 Self.Context.getTypeSize(DestType)) && in CheckCStyleCast()
3083 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in CheckCStyleCast()
3087 if (Self.getLangOpts().OpenCL && !Self.getOpenCLOptions().isAvailableOption( in CheckCStyleCast()
3088 "cl_khr_fp16", Self.getLangOpts())) { in CheckCStyleCast()
3090 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_opencl_cast_to_half) in CheckCStyleCast()
3098 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) { in CheckCStyleCast()
3104 if (Self.getLangOpts().ObjCAutoRefCount && CastPtr) { in CheckCStyleCast()
3111 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3119 else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) { in CheckCStyleCast()
3120 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3128 if (!checkCastFunctionType(Self, SrcExpr, DestType)) in CheckCStyleCast()
3129 Self.Diag(OpRange.getBegin(), diag::warn_cast_function_type) in CheckCStyleCast()
3142 Self.Diag(OpRange.getBegin(), diag::err_cast_from_randomized_struct) in CheckCStyleCast()
3149 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in CheckCStyleCast()
3150 DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange); in CheckCStyleCast()
3151 DiagnoseBadFunctionCast(Self, SrcExpr, DestType); in CheckCStyleCast()
3152 Kind = Self.PrepareScalarCast(SrcExpr, DestType); in CheckCStyleCast()
3163 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in CheckBuiltinBitCast()
3165 Self.RequireCompleteType(OpRange.getBegin(), SrcType, in CheckBuiltinBitCast()
3172 SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcType, SrcExpr.get(), in CheckBuiltinBitCast()
3175 CharUnits DestSize = Self.Context.getTypeSizeInChars(DestType); in CheckBuiltinBitCast()
3176 CharUnits SourceSize = Self.Context.getTypeSizeInChars(SrcType); in CheckBuiltinBitCast()
3178 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_type_size_mismatch) in CheckBuiltinBitCast()
3184 if (!DestType.isTriviallyCopyableType(Self.Context)) { in CheckBuiltinBitCast()
3185 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_non_trivially_copyable) in CheckBuiltinBitCast()
3191 if (!SrcType.isTriviallyCopyableType(Self.Context)) { in CheckBuiltinBitCast()
3192 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_non_trivially_copyable) in CheckBuiltinBitCast()
3203 static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastQual() argument
3215 if (CastsAwayConstness(Self, SrcType, DestType, true, false, in DiagnoseCastQual()
3232 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual2) in DiagnoseCastQual()
3235 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual) in DiagnoseCastQual()
3258 DiagnoseCastQual(Op.Self, Op.SrcExpr, Op.DestType); in BuildCStyleCastExpr()