Lines Matching refs:Self
62 : Self(S), SrcExpr(src), DestType(destType), in CastOperation()
88 Sema &Self; member
126 Self.Context, Self.Context.ARCUnbridgedCastTy, CK_Dependent, in complete()
128 Self.CurFPFeatureOverrides()); in complete()
157 Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange); in checkCastAlign()
161 assert(Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()); in checkObjCConversion()
164 if (Self.ObjC().CheckObjCConversion(OpRange, DestType, src, CCK) == in checkObjCConversion()
175 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in checkNonOverloadPlaceholders()
199 CheckNoDeref(Op.Self, Op.SrcExpr.get()->getType(), Op.ResultType, in ~CheckNoDerefRAII()
207 static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr,
221 static TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr,
226 static TryCastResult TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr,
232 static TryCastResult TryStaticPointerDowncast(Sema &Self, QualType SrcType,
238 static TryCastResult TryStaticDowncast(Sema &Self, CanQualType SrcType,
245 static TryCastResult TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr,
254 TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType,
257 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
262 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr,
265 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
269 static TryCastResult TryAddressSpaceCast(Sema &Self, ExprResult &SrcExpr,
670 CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, in CastsAwayConstness() argument
677 if (!CheckCVR && CheckObjCLifetime && !Self.Context.getLangOpts().ObjC) in CastsAwayConstness()
689 QualType UnwrappedSrcType = Self.Context.getCanonicalType(SrcType), in CastsAwayConstness()
690 UnwrappedDestType = Self.Context.getCanonicalType(DestType); in CastsAwayConstness()
700 Self.Context, UnwrappedSrcType, UnwrappedDestType)) { in CastsAwayConstness()
708 Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals); in CastsAwayConstness()
709 Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals); in CastsAwayConstness()
792 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckDynamicCast()
794 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in CheckDynamicCast()
799 QualType DestType = Self.Context.getCanonicalType(this->DestType); in CheckDynamicCast()
812 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ref_or_ptr) in CheckDynamicCast()
822 if (Self.RequireCompleteType(OpRange.getBegin(), DestPointee, in CheckDynamicCast()
829 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) in CheckDynamicCast()
839 QualType SrcType = Self.Context.getCanonicalType(OrigSrcType); in CheckDynamicCast()
845 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ptr) in CheckDynamicCast()
852 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue) in CheckDynamicCast()
860 SrcExpr = Self.CreateMaterializeTemporaryExpr( in CheckDynamicCast()
867 if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee, in CheckDynamicCast()
874 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) in CheckDynamicCast()
888 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_qualifiers_away) in CheckDynamicCast()
904 Self.IsDerivedFrom(OpRange.getBegin(), SrcPointee, DestPointee)) { in CheckDynamicCast()
905 if (Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee, in CheckDynamicCast()
920 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic) in CheckDynamicCast()
928 if (!Self.getLangOpts().RTTI && !DestPointee->isVoidType()) { in CheckDynamicCast()
929 Self.Diag(OpRange.getBegin(), diag::err_no_dynamic_cast_with_fno_rtti); in CheckDynamicCast()
935 if (!Self.getLangOpts().RTTIData) { in CheckDynamicCast()
937 Self.getASTContext().getTargetInfo().getCXXABI().isMicrosoft(); in CheckDynamicCast()
938 bool isClangCL = Self.getDiagnostics().getDiagnosticOptions().getFormat() == in CheckDynamicCast()
941 Self.Diag(OpRange.getBegin(), in CheckDynamicCast()
951 Self.MarkVTableUsed(OpRange.getBegin(), DestDecl); in CheckDynamicCast()
967 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckConstCast()
969 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in CheckConstCast()
974 auto TCR = TryConstCast(Self, SrcExpr, DestType, /*CStyle*/ false, msg); in CheckConstCast()
976 Self.Diag(OpRange.getBegin(), msg) << CT_Const in CheckConstCast()
986 TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ false, msg, Kind); in CheckAddrspaceCast()
988 Self.Diag(OpRange.getBegin(), msg) in CheckAddrspaceCast()
997 static void DiagnoseReinterpretUpDownCast(Sema &Self, const Expr *SrcExpr, in DiagnoseReinterpretUpDownCast() argument
1056 Self.Context.getASTRecordLayout(Class); in DiagnoseReinterpretUpDownCast()
1080 Self.Diag(BeginLoc, diag::warn_reinterpret_different_from_static) in DiagnoseReinterpretUpDownCast()
1083 Self.Diag(BeginLoc, diag::note_reinterpret_updowncast_use_static) in DiagnoseReinterpretUpDownCast()
1103 static unsigned int checkCastFunctionType(Sema &Self, const ExprResult &SrcExpr, in checkCastFunctionType() argument
1109 if (!Self.Diags.isIgnored(ID, SrcExpr.get()->getExprLoc())) { in checkCastFunctionType()
1134 if (Self.Context.hasSameType(SrcFTy, DstFTy)) in checkCastFunctionType()
1155 Self.Context)) in checkCastFunctionType()
1182 DstFPTy->getParamType(i), Self.Context)) in checkCastFunctionType()
1195 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckReinterpretCast()
1203 TryReinterpretCast(Self, SrcExpr, DestType, in CheckReinterpretCast()
1208 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckReinterpretCast()
1210 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_overload) in CheckReinterpretCast()
1213 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckReinterpretCast()
1216 diagnoseBadCast(Self, msg, CT_Reinterpret, OpRange, SrcExpr.get(), in CheckReinterpretCast()
1222 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) in CheckReinterpretCast()
1224 DiagnoseReinterpretUpDownCast(Self, SrcExpr.get(), DestType, OpRange); in CheckReinterpretCast()
1226 if (unsigned DiagID = checkCastFunctionType(Self, SrcExpr, DestType)) in CheckReinterpretCast()
1227 Self.Diag(OpRange.getBegin(), DiagID) in CheckReinterpretCast()
1254 Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr, in CheckStaticCast()
1262 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckStaticCast()
1268 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckStaticCast()
1275 TryStaticCast(Self, SrcExpr, DestType, CheckedConversionKind::OtherCast, in CheckStaticCast()
1280 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckStaticCast()
1282 Self.Diag(OpRange.getBegin(), diag::err_bad_static_cast_overload) in CheckStaticCast()
1285 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckStaticCast()
1287 diagnoseBadCast(Self, msg, CT_Static, OpRange, SrcExpr.get(), DestType, in CheckStaticCast()
1295 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) in CheckStaticCast()
1316 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr, in TryStaticCast() argument
1345 tcr = TryStaticReferenceDowncast(Self, SrcExpr.get(), DestType, CStyle, in TryStaticCast()
1353 tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind, in TryStaticCast()
1360 tcr = TryStaticImplicitCast(Self, SrcExpr, DestType, CCK, OpRange, msg, in TryStaticCast()
1377 QualType SrcType = Self.Context.getCanonicalType(SrcExpr.get()->getType()); in TryStaticCast()
1387 } else if (DestType->isIntegralType(Self.Context)) { in TryStaticCast()
1406 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in TryStaticCast()
1428 tcr = TryStaticPointerDowncast(Self, SrcType, DestType, CStyle, OpRange, msg, in TryStaticCast()
1436 tcr = TryStaticMemberPointerUpcast(Self, SrcExpr, SrcType, DestType, CStyle, in TryStaticCast()
1474 if (!CStyle && Self.getLangOpts().MSVCCompat && in TryStaticCast()
1476 Self.Diag(OpRange.getBegin(), diag::ext_ms_cast_fn_obj) << OpRange; in TryStaticCast()
1503 Self.ObjC().CheckTollFreeBridgeStaticCast(DestType, SrcExpr.get(), Kind)) in TryStaticCast()
1515 if (Self.CheckMatrixCast(OpRange, DestType, SrcType, Kind)) { in TryStaticCast()
1527 TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, in TryLValueToRValueCast() argument
1552 Sema::ReferenceCompareResult RefResult = Self.CompareReferenceRelationship( in TryLValueToRValueCast()
1569 if (!Self.IsDerivedFrom(SrcExpr->getBeginLoc(), SrcExpr->getType(), in TryLValueToRValueCast()
1573 Self.BuildBasePathArray(Paths, BasePath); in TryLValueToRValueCast()
1582 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType, in TryStaticReferenceDowncast() argument
1611 return TryStaticDowncast(Self, in TryStaticReferenceDowncast()
1612 Self.Context.getCanonicalType(SrcExpr->getType()), in TryStaticReferenceDowncast()
1613 Self.Context.getCanonicalType(DestPointee), CStyle, in TryStaticReferenceDowncast()
1620 TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType, in TryStaticPointerDowncast() argument
1643 return TryStaticDowncast(Self, in TryStaticPointerDowncast()
1644 Self.Context.getCanonicalType(SrcPointer->getPointeeType()), in TryStaticPointerDowncast()
1645 Self.Context.getCanonicalType(DestPointer->getPointeeType()), in TryStaticPointerDowncast()
1654 TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType, in TryStaticDowncast() argument
1659 if (!Self.isCompleteType(OpRange.getBegin(), SrcType) || in TryStaticDowncast()
1660 !Self.isCompleteType(OpRange.getBegin(), DestType)) in TryStaticDowncast()
1670 if (!Self.IsDerivedFrom(OpRange.getBegin(), DestType, SrcType, Paths)) { in TryStaticDowncast()
1706 Self.IsDerivedFrom(OpRange.getBegin(), DestType, SrcType, Paths); in TryStaticDowncast()
1721 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_base_to_derived_cast) in TryStaticDowncast()
1731 Self.Diag(OpRange.getBegin(), diag::err_static_downcast_via_virtual) in TryStaticDowncast()
1738 switch (Self.CheckBaseClassAccess(OpRange.getBegin(), in TryStaticDowncast()
1753 Self.BuildBasePathArray(Paths, BasePath); in TryStaticDowncast()
1766 TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType, in TryStaticMemberPointerUpcast() argument
1777 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in TryStaticMemberPointerUpcast()
1779 = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), DestType, false, in TryStaticMemberPointerUpcast()
1782 SrcType = Self.Context.getMemberPointerType(Fn->getType(), in TryStaticMemberPointerUpcast()
1783 Self.Context.getTypeDeclType(M->getParent()).getTypePtr()); in TryStaticMemberPointerUpcast()
1796 if (Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) { in TryStaticMemberPointerUpcast()
1797 (void)Self.isCompleteType(OpRange.getBegin(), SrcType); in TryStaticMemberPointerUpcast()
1798 (void)Self.isCompleteType(OpRange.getBegin(), DestType); in TryStaticMemberPointerUpcast()
1802 if (!Self.Context.hasSameUnqualifiedType(SrcMemPtr->getPointeeType(), in TryStaticMemberPointerUpcast()
1811 if (!Self.IsDerivedFrom(OpRange.getBegin(), SrcClass, DestClass, Paths)) in TryStaticMemberPointerUpcast()
1815 if (Paths.isAmbiguous(Self.Context.getCanonicalType(DestClass))) { in TryStaticMemberPointerUpcast()
1819 Self.IsDerivedFrom(OpRange.getBegin(), SrcClass, DestClass, Paths); in TryStaticMemberPointerUpcast()
1822 std::string PathDisplayStr = Self.getAmbiguousPathsDisplayString(Paths); in TryStaticMemberPointerUpcast()
1823 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_memptr_conv) in TryStaticMemberPointerUpcast()
1830 Self.Diag(OpRange.getBegin(), diag::err_memptr_conv_via_virtual) in TryStaticMemberPointerUpcast()
1837 switch (Self.CheckBaseClassAccess(OpRange.getBegin(), in TryStaticMemberPointerUpcast()
1857 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in TryStaticMemberPointerUpcast()
1866 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr, FoundOverload, Fn); in TryStaticMemberPointerUpcast()
1873 Self.BuildBasePathArray(Paths, BasePath); in TryStaticMemberPointerUpcast()
1883 TryCastResult TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, in TryStaticImplicitCast() argument
1889 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in TryStaticImplicitCast()
1891 Self.RequireNonAbstractType(OpRange.getBegin(), DestType, in TryStaticImplicitCast()
1911 InitializationSequence InitSeq(Self, Entity, InitKind, SrcExprRaw); in TryStaticImplicitCast()
1923 ExprResult Result = InitSeq.Perform(Self, Entity, InitKind, SrcExprRaw); in TryStaticImplicitCast()
1940 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr, in TryConstCast() argument
1943 DestType = Self.Context.getCanonicalType(DestType); in TryConstCast()
1990 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType()); in TryConstCast()
1991 SrcType = Self.Context.getPointerType(SrcType); in TryConstCast()
2025 if (!Self.Context.hasCvrSimilarType(SrcType, DestType)) in TryConstCast()
2031 SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcExpr.get()->getType(), in TryConstCast()
2093 static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastOfObjCSEL() argument
2096 if (Self.Context.hasSameType(SrcType, DestType)) in DiagnoseCastOfObjCSEL()
2104 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseCastOfObjCSEL()
2112 static void DiagnoseCallingConvCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCallingConvCast() argument
2117 if (Self.Context.hasSameType(SrcType, DstType) || in DiagnoseCallingConvCast()
2146 CallingConv DefaultCC = Self.getASTContext().getDefaultCallingConvention( in DiagnoseCallingConvCast()
2154 Self.Diag(OpRange.getBegin(), diag::warn_cast_calling_conv) in DiagnoseCallingConvCast()
2160 if (Self.Diags.isIgnored(diag::warn_cast_calling_conv, OpRange.getBegin())) in DiagnoseCallingConvCast()
2168 Preprocessor &PP = Self.getPreprocessor(); in DiagnoseCallingConvCast()
2172 if (Self.getLangOpts().MicrosoftExt) { in DiagnoseCallingConvCast()
2176 AttrTokens.push_back(II->isKeyword(Self.getLangOpts()) in DiagnoseCallingConvCast()
2186 AttrTokens.push_back(II->isKeyword(Self.getLangOpts()) in DiagnoseCallingConvCast()
2196 Self.Diag(NameLoc, diag::note_change_calling_conv_fixit) in DiagnoseCallingConvCast()
2202 Sema &Self) { in checkIntToPointerCast() argument
2208 if (CStyle && SrcType->isIntegralType(Self.Context) in checkIntToPointerCast()
2211 && !SrcExpr->isIntegerConstantExpr(Self.Context) in checkIntToPointerCast()
2212 && Self.Context.getTypeSize(DestType) > in checkIntToPointerCast()
2213 Self.Context.getTypeSize(SrcType)) { in checkIntToPointerCast()
2222 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in checkIntToPointerCast()
2226 static bool fixOverloadedReinterpretCastExpr(Sema &Self, QualType DestType, in fixOverloadedReinterpretCastExpr() argument
2237 if (Self.ResolveAndFixSingleFunctionTemplateSpecialization( in fixOverloadedReinterpretCastExpr()
2248 if (!Self.resolveAndFixAddressOfSingleOverloadCandidate( in fixOverloadedReinterpretCastExpr()
2254 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, in TryReinterpretCast() argument
2261 DestType = Self.Context.getCanonicalType(DestType); in TryReinterpretCast()
2266 if (SrcType == Self.Context.OverloadTy) { in TryReinterpretCast()
2268 if (!fixOverloadedReinterpretCastExpr(Self, DestType, FixedExpr)) in TryReinterpretCast()
2285 Self.CheckCompatibleReinterpretCast(SrcType, DestType, in TryReinterpretCast()
2310 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_reference) in TryReinterpretCast()
2318 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType()); in TryReinterpretCast()
2319 SrcType = Self.Context.getPointerType(SrcType); in TryReinterpretCast()
2325 SrcType = Self.Context.getCanonicalType(SrcType); in TryReinterpretCast()
2338 if (Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) { in TryReinterpretCast()
2341 (void)Self.isCompleteType(OpRange.getBegin(), SrcType); in TryReinterpretCast()
2342 (void)Self.isCompleteType(OpRange.getBegin(), DestType); in TryReinterpretCast()
2346 if (Self.Context.getTypeSize(DestMemPtr) != in TryReinterpretCast()
2347 Self.Context.getTypeSize(SrcMemPtr)) { in TryReinterpretCast()
2357 CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle, in TryReinterpretCast()
2368 if (SrcType->isNullPtrType() && DestType->isIntegralType(Self.Context)) { in TryReinterpretCast()
2373 if (Self.Context.getTypeSize(SrcType) > in TryReinterpretCast()
2374 Self.Context.getTypeSize(DestType)) { in TryReinterpretCast()
2388 if (Self.isValidSveBitcast(SrcType, DestType)) { in TryReinterpretCast()
2394 if (Self.RISCV().isValidRVVBitcast(SrcType, DestType)) { in TryReinterpretCast()
2402 if ((!destIsVector && !DestType->isIntegralType(Self.Context)) || in TryReinterpretCast()
2403 (!srcIsVector && !SrcType->isIntegralType(Self.Context))) in TryReinterpretCast()
2408 if (Self.areLaxCompatibleVectorTypes(SrcType, DestType)) { in TryReinterpretCast()
2413 if (Self.LangOpts.OpenCL && !CStyle) { in TryReinterpretCast()
2416 if (Self.areVectorTypesSameSize(SrcType, DestType)) { in TryReinterpretCast()
2464 if (DestType->isIntegralType(Self.Context)) { in TryReinterpretCast()
2469 if ((Self.Context.getTypeSize(SrcType) > in TryReinterpretCast()
2470 Self.Context.getTypeSize(DestType))) { in TryReinterpretCast()
2472 Self.getLangOpts().MicrosoftExt && !DestType->isBooleanType(); in TryReinterpretCast()
2477 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in TryReinterpretCast()
2489 checkIntToPointerCast(CStyle, OpRange, SrcExpr.get(), DestType, Self); in TryReinterpretCast()
2513 CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle, in TryReinterpretCast()
2528 Kind = Self.ObjC().PrepareCastToObjCObjectPointer(SrcExpr); in TryReinterpretCast()
2545 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in TryReinterpretCast()
2547 DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange); in TryReinterpretCast()
2565 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2566 Self.getLangOpts().CPlusPlus11 ? in TryReinterpretCast()
2574 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2575 Self.getLangOpts().CPlusPlus11 ? in TryReinterpretCast()
2590 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2607 static TryCastResult TryAddressSpaceCast(Sema &Self, ExprResult &SrcExpr, in TryAddressSpaceCast() argument
2610 if (!Self.getLangOpts().OpenCL && !Self.getLangOpts().SYCLIsDevice) in TryAddressSpaceCast()
2634 Self.Context.removeAddrSpaceQualType(SrcPointeeType.getCanonicalType()); in TryAddressSpaceCast()
2636 Self.Context.removeAddrSpaceQualType(DestPointeeType.getCanonicalType()); in TryAddressSpaceCast()
2637 if (Self.Context.hasSameType(SrcPointeeTypeWithoutAS, in TryAddressSpaceCast()
2660 if (Self.getLangOpts().OpenCL) { in checkAddressSpaceCast()
2664 DestPtr = Self.getASTContext().getCanonicalType(DestType.getTypePtr()), in checkAddressSpaceCast()
2665 SrcPtr = Self.getASTContext().getCanonicalType(SrcType.getTypePtr()); in checkAddressSpaceCast()
2675 Self.Diag(OpRange.getBegin(), DiagID) in checkAddressSpaceCast()
2719 assert(Self.getLangOpts().CPlusPlus); in CheckCXXCStyleCast()
2725 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCXXCStyleCast()
2743 Self.ResolveAndFixSingleFunctionTemplateSpecialization( in CheckCXXCStyleCast()
2751 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckCXXCStyleCast()
2764 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckCXXCStyleCast()
2771 if (Self.CheckAltivecInitFromScalar(OpRange, DestType, in CheckCXXCStyleCast()
2776 if (Self.ShouldSplatAltivecScalarInCast(vecTy) && in CheckCXXCStyleCast()
2780 SrcExpr = Self.prepareVectorSplat(DestType, SrcExpr.get()); in CheckCXXCStyleCast()
2788 Self.Diag(OpRange.getBegin(), diag::err_wasm_cast_table) in CheckCXXCStyleCast()
2807 TryCastResult tcr = TryConstCast(Self, SrcExpr, DestType, in CheckCXXCStyleCast()
2818 tcr = TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ true, msg, in CheckCXXCStyleCast()
2826 tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange, msg, Kind, in CheckCXXCStyleCast()
2833 tcr = TryReinterpretCast(Self, SrcExpr, DestType, /*CStyle*/ true, in CheckCXXCStyleCast()
2841 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() && in CheckCXXCStyleCast()
2846 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCXXCStyleCast()
2848 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in CheckCXXCStyleCast()
2857 Self.Diag(OpRange.getBegin(), diag::err_bad_cstyle_cast_overload) in CheckCXXCStyleCast()
2860 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckCXXCStyleCast()
2863 diagnoseBadCast(Self, msg, (FunctionalStyle ? CT_Functional : CT_CStyle), in CheckCXXCStyleCast()
2872 if (unsigned DiagID = checkCastFunctionType(Self, SrcExpr, DestType)) in CheckCXXCStyleCast()
2873 Self.Diag(OpRange.getBegin(), DiagID) in CheckCXXCStyleCast()
2884 static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseBadFunctionCast() argument
2886 if (Self.Diags.isIgnored(diag::warn_bad_function_cast, in DiagnoseBadFunctionCast()
2914 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseBadFunctionCast()
2921 assert(!Self.getLangOpts().CPlusPlus); in CheckCStyleCast()
2925 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCStyleCast()
2935 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckCStyleCast()
2945 if (Self.getASTContext().isDependenceAllowed() && in CheckCStyleCast()
2956 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCStyleCast()
2958 if (FunctionDecl *FD = Self.ResolveAddressOfOverloadedFunction( in CheckCStyleCast()
2960 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr.get(), DAP, FD); in CheckCStyleCast()
2965 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckCStyleCast()
2971 Self.Diag(OpRange.getBegin(), diag::err_wasm_cast_table) in CheckCStyleCast()
2983 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in CheckCStyleCast()
2991 Self.Context.hasSameUnqualifiedType(DestType, SrcType)) { in CheckCStyleCast()
2998 Self.isValidSveBitcast(SrcType, DestType)) { in CheckCStyleCast()
3005 Self.RISCV().isValidRVVBitcast(SrcType, DestType)) { in CheckCStyleCast()
3014 if (DestRecordTy && Self.Context.hasSameUnqualifiedType(DestType, SrcType)){ in CheckCStyleCast()
3016 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_nonscalar) in CheckCStyleCast()
3026 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union) in CheckCStyleCast()
3031 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cast_to_union_no_type) in CheckCStyleCast()
3039 if (Self.getLangOpts().OpenCL && DestType->isEventT()) { in CheckCStyleCast()
3041 if (SrcExpr.get()->EvaluateAsInt(Result, Self.Context)) { in CheckCStyleCast()
3047 Self.Diag(OpRange.getBegin(), in CheckCStyleCast()
3056 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cond_expect_scalar) in CheckCStyleCast()
3067 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
3084 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast) in CheckCStyleCast()
3093 SrcExpr = ImplicitCastExpr::Create(Self.Context, DestType, CK, in CheckCStyleCast()
3095 Self.CurFPFeatureOverrides()); in CheckCStyleCast()
3099 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast) in CheckCStyleCast()
3106 SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.get(), Kind); in CheckCStyleCast()
3111 if (Self.CheckMatrixCast(OpRange, DestType, SrcType, Kind)) in CheckCStyleCast()
3117 if (Self.CheckAltivecInitFromScalar(OpRange, DestType, SrcType)) { in CheckCStyleCast()
3121 if (Self.ShouldSplatAltivecScalarInCast(DestVecTy) && in CheckCStyleCast()
3124 SrcExpr = Self.prepareVectorSplat(DestType, SrcExpr.get()); in CheckCStyleCast()
3125 } else if (Self.CheckVectorCast(OpRange, DestType, SrcType, Kind)) { in CheckCStyleCast()
3132 if (Self.CheckVectorCast(OpRange, SrcType, DestType, Kind)) in CheckCStyleCast()
3143 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_selector_expr); in CheckCStyleCast()
3151 if (!SrcType->isIntegralType(Self.Context) && SrcType->isArithmeticType()) { in CheckCStyleCast()
3152 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
3159 Self); in CheckCStyleCast()
3161 if (!DestType->isIntegralType(Self.Context) && in CheckCStyleCast()
3163 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3170 if ((Self.Context.getTypeSize(SrcType) > in CheckCStyleCast()
3171 Self.Context.getTypeSize(DestType)) && in CheckCStyleCast()
3186 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in CheckCStyleCast()
3190 if (Self.getLangOpts().OpenCL && !Self.getOpenCLOptions().isAvailableOption( in CheckCStyleCast()
3191 "cl_khr_fp16", Self.getLangOpts())) { in CheckCStyleCast()
3193 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_opencl_cast_to_half) in CheckCStyleCast()
3201 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) { in CheckCStyleCast()
3207 if (Self.getLangOpts().ObjCAutoRefCount && CastPtr) { in CheckCStyleCast()
3214 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3221 } else if (!Self.ObjC().CheckObjCARCUnavailableWeakConversion(DestType, in CheckCStyleCast()
3223 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3231 if (unsigned DiagID = checkCastFunctionType(Self, SrcExpr, DestType)) in CheckCStyleCast()
3232 Self.Diag(OpRange.getBegin(), DiagID) << SrcType << DestType << OpRange; in CheckCStyleCast()
3244 Self.Diag(OpRange.getBegin(), diag::err_cast_from_randomized_struct) in CheckCStyleCast()
3251 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in CheckCStyleCast()
3252 DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange); in CheckCStyleCast()
3253 DiagnoseBadFunctionCast(Self, SrcExpr, DestType); in CheckCStyleCast()
3254 Kind = Self.PrepareScalarCast(SrcExpr, DestType); in CheckCStyleCast()
3265 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in CheckBuiltinBitCast()
3267 Self.RequireCompleteType(OpRange.getBegin(), SrcType, in CheckBuiltinBitCast()
3274 SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcType, SrcExpr.get(), in CheckBuiltinBitCast()
3277 CharUnits DestSize = Self.Context.getTypeSizeInChars(DestType); in CheckBuiltinBitCast()
3278 CharUnits SourceSize = Self.Context.getTypeSizeInChars(SrcType); in CheckBuiltinBitCast()
3280 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_type_size_mismatch) in CheckBuiltinBitCast()
3286 if (!DestType.isTriviallyCopyableType(Self.Context)) { in CheckBuiltinBitCast()
3287 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_non_trivially_copyable) in CheckBuiltinBitCast()
3293 if (!SrcType.isTriviallyCopyableType(Self.Context)) { in CheckBuiltinBitCast()
3294 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_non_trivially_copyable) in CheckBuiltinBitCast()
3305 static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastQual() argument
3317 if (CastsAwayConstness(Self, SrcType, DestType, true, false, in DiagnoseCastQual()
3334 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual2) in DiagnoseCastQual()
3337 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual) in DiagnoseCastQual()
3360 DiagnoseCastQual(Op.Self, Op.SrcExpr, Op.DestType); in BuildCStyleCastExpr()
3388 DiagnoseCastQual(Op.Self, Op.SrcExpr, Op.DestType); in BuildCXXFunctionalCastExpr()