Lines Matching refs:Self
60 : Self(S), SrcExpr(src), DestType(destType), in CastOperation()
86 Sema &Self; member
124 Self.Context, Self.Context.ARCUnbridgedCastTy, CK_Dependent, in complete()
126 Self.CurFPFeatureOverrides()); in complete()
155 Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange); in checkCastAlign()
159 assert(Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()); in checkObjCConversion()
162 if (Self.CheckObjCConversion(OpRange, DestType, src, CCK) == in checkObjCConversion()
173 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in checkNonOverloadPlaceholders()
197 CheckNoDeref(Op.Self, Op.SrcExpr.get()->getType(), Op.ResultType, in ~CheckNoDerefRAII()
205 static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr,
219 static TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr,
224 static TryCastResult TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr,
230 static TryCastResult TryStaticPointerDowncast(Sema &Self, QualType SrcType,
236 static TryCastResult TryStaticDowncast(Sema &Self, CanQualType SrcType,
243 static TryCastResult TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr,
251 static TryCastResult TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr,
257 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
264 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr,
267 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
271 static TryCastResult TryAddressSpaceCast(Sema &Self, ExprResult &SrcExpr,
662 CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, in CastsAwayConstness() argument
669 if (!CheckCVR && CheckObjCLifetime && !Self.Context.getLangOpts().ObjC) in CastsAwayConstness()
681 QualType UnwrappedSrcType = Self.Context.getCanonicalType(SrcType), in CastsAwayConstness()
682 UnwrappedDestType = Self.Context.getCanonicalType(DestType); in CastsAwayConstness()
692 Self.Context, UnwrappedSrcType, UnwrappedDestType)) { in CastsAwayConstness()
700 Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals); in CastsAwayConstness()
701 Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals); in CastsAwayConstness()
784 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckDynamicCast()
786 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in CheckDynamicCast()
791 QualType DestType = Self.Context.getCanonicalType(this->DestType); in CheckDynamicCast()
804 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ref_or_ptr) in CheckDynamicCast()
814 if (Self.RequireCompleteType(OpRange.getBegin(), DestPointee, in CheckDynamicCast()
821 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) in CheckDynamicCast()
831 QualType SrcType = Self.Context.getCanonicalType(OrigSrcType); in CheckDynamicCast()
837 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ptr) in CheckDynamicCast()
844 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue) in CheckDynamicCast()
852 SrcExpr = Self.CreateMaterializeTemporaryExpr( in CheckDynamicCast()
859 if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee, in CheckDynamicCast()
866 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) in CheckDynamicCast()
880 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_qualifiers_away) in CheckDynamicCast()
896 Self.IsDerivedFrom(OpRange.getBegin(), SrcPointee, DestPointee)) { in CheckDynamicCast()
897 if (Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee, in CheckDynamicCast()
912 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic) in CheckDynamicCast()
920 if (!Self.getLangOpts().RTTI && !DestPointee->isVoidType()) { in CheckDynamicCast()
921 Self.Diag(OpRange.getBegin(), diag::err_no_dynamic_cast_with_fno_rtti); in CheckDynamicCast()
927 if (!Self.getLangOpts().RTTIData) { in CheckDynamicCast()
929 Self.getASTContext().getTargetInfo().getCXXABI().isMicrosoft(); in CheckDynamicCast()
930 bool isClangCL = Self.getDiagnostics().getDiagnosticOptions().getFormat() == in CheckDynamicCast()
933 Self.Diag(OpRange.getBegin(), in CheckDynamicCast()
943 Self.MarkVTableUsed(OpRange.getBegin(), DestDecl); in CheckDynamicCast()
959 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckConstCast()
961 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in CheckConstCast()
966 auto TCR = TryConstCast(Self, SrcExpr, DestType, /*CStyle*/ false, msg); in CheckConstCast()
968 Self.Diag(OpRange.getBegin(), msg) << CT_Const in CheckConstCast()
978 TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ false, msg, Kind); in CheckAddrspaceCast()
980 Self.Diag(OpRange.getBegin(), msg) in CheckAddrspaceCast()
989 static void DiagnoseReinterpretUpDownCast(Sema &Self, const Expr *SrcExpr, in DiagnoseReinterpretUpDownCast() argument
1048 Self.Context.getASTRecordLayout(Class); in DiagnoseReinterpretUpDownCast()
1072 Self.Diag(BeginLoc, diag::warn_reinterpret_different_from_static) in DiagnoseReinterpretUpDownCast()
1075 Self.Diag(BeginLoc, diag::note_reinterpret_updowncast_use_static) in DiagnoseReinterpretUpDownCast()
1094 static unsigned int checkCastFunctionType(Sema &Self, const ExprResult &SrcExpr, in checkCastFunctionType() argument
1100 if (!Self.Diags.isIgnored(ID, SrcExpr.get()->getExprLoc())) { in checkCastFunctionType()
1125 if (Self.Context.hasSameType(SrcFTy, DstFTy)) in checkCastFunctionType()
1146 Self.Context)) in checkCastFunctionType()
1173 DstFPTy->getParamType(i), Self.Context)) in checkCastFunctionType()
1186 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckReinterpretCast()
1194 TryReinterpretCast(Self, SrcExpr, DestType, in CheckReinterpretCast()
1199 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckReinterpretCast()
1201 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_overload) in CheckReinterpretCast()
1204 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckReinterpretCast()
1207 diagnoseBadCast(Self, msg, CT_Reinterpret, OpRange, SrcExpr.get(), in CheckReinterpretCast()
1213 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) in CheckReinterpretCast()
1215 DiagnoseReinterpretUpDownCast(Self, SrcExpr.get(), DestType, OpRange); in CheckReinterpretCast()
1217 if (unsigned DiagID = checkCastFunctionType(Self, SrcExpr, DestType)) in CheckReinterpretCast()
1218 Self.Diag(OpRange.getBegin(), DiagID) in CheckReinterpretCast()
1245 Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr, in CheckStaticCast()
1253 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckStaticCast()
1259 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckStaticCast()
1266 = TryStaticCast(Self, SrcExpr, DestType, Sema::CCK_OtherCast, OpRange, msg, in CheckStaticCast()
1271 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckStaticCast()
1273 Self.Diag(OpRange.getBegin(), diag::err_bad_static_cast_overload) in CheckStaticCast()
1276 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckStaticCast()
1278 diagnoseBadCast(Self, msg, CT_Static, OpRange, SrcExpr.get(), DestType, in CheckStaticCast()
1286 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) in CheckStaticCast()
1307 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr, in TryStaticCast() argument
1337 tcr = TryStaticReferenceDowncast(Self, SrcExpr.get(), DestType, CStyle, in TryStaticCast()
1345 tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind, in TryStaticCast()
1352 tcr = TryStaticImplicitCast(Self, SrcExpr, DestType, CCK, OpRange, msg, in TryStaticCast()
1369 QualType SrcType = Self.Context.getCanonicalType(SrcExpr.get()->getType()); in TryStaticCast()
1379 } else if (DestType->isIntegralType(Self.Context)) { in TryStaticCast()
1398 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in TryStaticCast()
1420 tcr = TryStaticPointerDowncast(Self, SrcType, DestType, CStyle, OpRange, msg, in TryStaticCast()
1428 tcr = TryStaticMemberPointerUpcast(Self, SrcExpr, SrcType, DestType, CStyle, in TryStaticCast()
1466 if (!CStyle && Self.getLangOpts().MSVCCompat && in TryStaticCast()
1468 Self.Diag(OpRange.getBegin(), diag::ext_ms_cast_fn_obj) << OpRange; in TryStaticCast()
1495 Self.CheckTollFreeBridgeStaticCast(DestType, SrcExpr.get(), Kind)) in TryStaticCast()
1507 if (Self.CheckMatrixCast(OpRange, DestType, SrcType, Kind)) { in TryStaticCast()
1519 TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, in TryLValueToRValueCast() argument
1544 Sema::ReferenceCompareResult RefResult = Self.CompareReferenceRelationship( in TryLValueToRValueCast()
1561 if (!Self.IsDerivedFrom(SrcExpr->getBeginLoc(), SrcExpr->getType(), in TryLValueToRValueCast()
1565 Self.BuildBasePathArray(Paths, BasePath); in TryLValueToRValueCast()
1574 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType, in TryStaticReferenceDowncast() argument
1603 return TryStaticDowncast(Self, in TryStaticReferenceDowncast()
1604 Self.Context.getCanonicalType(SrcExpr->getType()), in TryStaticReferenceDowncast()
1605 Self.Context.getCanonicalType(DestPointee), CStyle, in TryStaticReferenceDowncast()
1612 TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType, in TryStaticPointerDowncast() argument
1635 return TryStaticDowncast(Self, in TryStaticPointerDowncast()
1636 Self.Context.getCanonicalType(SrcPointer->getPointeeType()), in TryStaticPointerDowncast()
1637 Self.Context.getCanonicalType(DestPointer->getPointeeType()), in TryStaticPointerDowncast()
1646 TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType, in TryStaticDowncast() argument
1651 if (!Self.isCompleteType(OpRange.getBegin(), SrcType) || in TryStaticDowncast()
1652 !Self.isCompleteType(OpRange.getBegin(), DestType)) in TryStaticDowncast()
1662 if (!Self.IsDerivedFrom(OpRange.getBegin(), DestType, SrcType, Paths)) { in TryStaticDowncast()
1698 Self.IsDerivedFrom(OpRange.getBegin(), DestType, SrcType, Paths); in TryStaticDowncast()
1713 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_base_to_derived_cast) in TryStaticDowncast()
1723 Self.Diag(OpRange.getBegin(), diag::err_static_downcast_via_virtual) in TryStaticDowncast()
1730 switch (Self.CheckBaseClassAccess(OpRange.getBegin(), in TryStaticDowncast()
1745 Self.BuildBasePathArray(Paths, BasePath); in TryStaticDowncast()
1758 TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType, in TryStaticMemberPointerUpcast() argument
1769 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in TryStaticMemberPointerUpcast()
1771 = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), DestType, false, in TryStaticMemberPointerUpcast()
1774 SrcType = Self.Context.getMemberPointerType(Fn->getType(), in TryStaticMemberPointerUpcast()
1775 Self.Context.getTypeDeclType(M->getParent()).getTypePtr()); in TryStaticMemberPointerUpcast()
1788 if (Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) { in TryStaticMemberPointerUpcast()
1789 (void)Self.isCompleteType(OpRange.getBegin(), SrcType); in TryStaticMemberPointerUpcast()
1790 (void)Self.isCompleteType(OpRange.getBegin(), DestType); in TryStaticMemberPointerUpcast()
1794 if (!Self.Context.hasSameUnqualifiedType(SrcMemPtr->getPointeeType(), in TryStaticMemberPointerUpcast()
1803 if (!Self.IsDerivedFrom(OpRange.getBegin(), SrcClass, DestClass, Paths)) in TryStaticMemberPointerUpcast()
1807 if (Paths.isAmbiguous(Self.Context.getCanonicalType(DestClass))) { in TryStaticMemberPointerUpcast()
1811 Self.IsDerivedFrom(OpRange.getBegin(), SrcClass, DestClass, Paths); in TryStaticMemberPointerUpcast()
1814 std::string PathDisplayStr = Self.getAmbiguousPathsDisplayString(Paths); in TryStaticMemberPointerUpcast()
1815 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_memptr_conv) in TryStaticMemberPointerUpcast()
1822 Self.Diag(OpRange.getBegin(), diag::err_memptr_conv_via_virtual) in TryStaticMemberPointerUpcast()
1829 switch (Self.CheckBaseClassAccess(OpRange.getBegin(), in TryStaticMemberPointerUpcast()
1849 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in TryStaticMemberPointerUpcast()
1858 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr, FoundOverload, Fn); in TryStaticMemberPointerUpcast()
1865 Self.BuildBasePathArray(Paths, BasePath); in TryStaticMemberPointerUpcast()
1876 TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, in TryStaticImplicitCast() argument
1881 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in TryStaticImplicitCast()
1883 Self.RequireNonAbstractType(OpRange.getBegin(), DestType, in TryStaticImplicitCast()
1902 InitializationSequence InitSeq(Self, Entity, InitKind, SrcExprRaw); in TryStaticImplicitCast()
1914 ExprResult Result = InitSeq.Perform(Self, Entity, InitKind, SrcExprRaw); in TryStaticImplicitCast()
1931 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr, in TryConstCast() argument
1934 DestType = Self.Context.getCanonicalType(DestType); in TryConstCast()
1981 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType()); in TryConstCast()
1982 SrcType = Self.Context.getPointerType(SrcType); in TryConstCast()
2016 if (!Self.Context.hasCvrSimilarType(SrcType, DestType)) in TryConstCast()
2022 SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcExpr.get()->getType(), in TryConstCast()
2084 static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastOfObjCSEL() argument
2087 if (Self.Context.hasSameType(SrcType, DestType)) in DiagnoseCastOfObjCSEL()
2095 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseCastOfObjCSEL()
2103 static void DiagnoseCallingConvCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCallingConvCast() argument
2108 if (Self.Context.hasSameType(SrcType, DstType) || in DiagnoseCallingConvCast()
2137 CallingConv DefaultCC = Self.getASTContext().getDefaultCallingConvention( in DiagnoseCallingConvCast()
2145 Self.Diag(OpRange.getBegin(), diag::warn_cast_calling_conv) in DiagnoseCallingConvCast()
2151 if (Self.Diags.isIgnored(diag::warn_cast_calling_conv, OpRange.getBegin())) in DiagnoseCallingConvCast()
2159 Preprocessor &PP = Self.getPreprocessor(); in DiagnoseCallingConvCast()
2163 if (Self.getLangOpts().MicrosoftExt) { in DiagnoseCallingConvCast()
2167 AttrTokens.push_back(II->isKeyword(Self.getLangOpts()) in DiagnoseCallingConvCast()
2177 AttrTokens.push_back(II->isKeyword(Self.getLangOpts()) in DiagnoseCallingConvCast()
2187 Self.Diag(NameLoc, diag::note_change_calling_conv_fixit) in DiagnoseCallingConvCast()
2193 Sema &Self) { in checkIntToPointerCast() argument
2199 if (CStyle && SrcType->isIntegralType(Self.Context) in checkIntToPointerCast()
2202 && !SrcExpr->isIntegerConstantExpr(Self.Context) in checkIntToPointerCast()
2203 && Self.Context.getTypeSize(DestType) > in checkIntToPointerCast()
2204 Self.Context.getTypeSize(SrcType)) { in checkIntToPointerCast()
2213 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in checkIntToPointerCast()
2217 static bool fixOverloadedReinterpretCastExpr(Sema &Self, QualType DestType, in fixOverloadedReinterpretCastExpr() argument
2228 if (Self.ResolveAndFixSingleFunctionTemplateSpecialization( in fixOverloadedReinterpretCastExpr()
2239 if (!Self.resolveAndFixAddressOfSingleOverloadCandidate( in fixOverloadedReinterpretCastExpr()
2245 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, in TryReinterpretCast() argument
2252 DestType = Self.Context.getCanonicalType(DestType); in TryReinterpretCast()
2257 if (SrcType == Self.Context.OverloadTy) { in TryReinterpretCast()
2259 if (!fixOverloadedReinterpretCastExpr(Self, DestType, FixedExpr)) in TryReinterpretCast()
2276 Self.CheckCompatibleReinterpretCast(SrcType, DestType, in TryReinterpretCast()
2301 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_reference) in TryReinterpretCast()
2309 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType()); in TryReinterpretCast()
2310 SrcType = Self.Context.getPointerType(SrcType); in TryReinterpretCast()
2316 SrcType = Self.Context.getCanonicalType(SrcType); in TryReinterpretCast()
2329 if (Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) { in TryReinterpretCast()
2332 (void)Self.isCompleteType(OpRange.getBegin(), SrcType); in TryReinterpretCast()
2333 (void)Self.isCompleteType(OpRange.getBegin(), DestType); in TryReinterpretCast()
2337 if (Self.Context.getTypeSize(DestMemPtr) != in TryReinterpretCast()
2338 Self.Context.getTypeSize(SrcMemPtr)) { in TryReinterpretCast()
2348 CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle, in TryReinterpretCast()
2359 if (SrcType->isNullPtrType() && DestType->isIntegralType(Self.Context)) { in TryReinterpretCast()
2364 if (Self.Context.getTypeSize(SrcType) > in TryReinterpretCast()
2365 Self.Context.getTypeSize(DestType)) { in TryReinterpretCast()
2379 if (Self.isValidSveBitcast(SrcType, DestType)) { in TryReinterpretCast()
2385 if (Self.isValidRVVBitcast(SrcType, DestType)) { in TryReinterpretCast()
2393 if ((!destIsVector && !DestType->isIntegralType(Self.Context)) || in TryReinterpretCast()
2394 (!srcIsVector && !SrcType->isIntegralType(Self.Context))) in TryReinterpretCast()
2399 if (Self.areLaxCompatibleVectorTypes(SrcType, DestType)) { in TryReinterpretCast()
2404 if (Self.LangOpts.OpenCL && !CStyle) { in TryReinterpretCast()
2407 if (Self.areVectorTypesSameSize(SrcType, DestType)) { in TryReinterpretCast()
2455 if (DestType->isIntegralType(Self.Context)) { in TryReinterpretCast()
2460 if ((Self.Context.getTypeSize(SrcType) > in TryReinterpretCast()
2461 Self.Context.getTypeSize(DestType))) { in TryReinterpretCast()
2463 Self.getLangOpts().MicrosoftExt && !DestType->isBooleanType(); in TryReinterpretCast()
2468 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in TryReinterpretCast()
2480 checkIntToPointerCast(CStyle, OpRange, SrcExpr.get(), DestType, Self); in TryReinterpretCast()
2504 CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle, in TryReinterpretCast()
2519 Kind = Self.PrepareCastToObjCObjectPointer(SrcExpr); in TryReinterpretCast()
2536 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in TryReinterpretCast()
2538 DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange); in TryReinterpretCast()
2556 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2557 Self.getLangOpts().CPlusPlus11 ? in TryReinterpretCast()
2565 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2566 Self.getLangOpts().CPlusPlus11 ? in TryReinterpretCast()
2581 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
2598 static TryCastResult TryAddressSpaceCast(Sema &Self, ExprResult &SrcExpr, in TryAddressSpaceCast() argument
2601 if (!Self.getLangOpts().OpenCL && !Self.getLangOpts().SYCLIsDevice) in TryAddressSpaceCast()
2625 Self.Context.removeAddrSpaceQualType(SrcPointeeType.getCanonicalType()); in TryAddressSpaceCast()
2627 Self.Context.removeAddrSpaceQualType(DestPointeeType.getCanonicalType()); in TryAddressSpaceCast()
2628 if (Self.Context.hasSameType(SrcPointeeTypeWithoutAS, in TryAddressSpaceCast()
2651 if (Self.getLangOpts().OpenCL) { in checkAddressSpaceCast()
2655 DestPtr = Self.getASTContext().getCanonicalType(DestType.getTypePtr()), in checkAddressSpaceCast()
2656 SrcPtr = Self.getASTContext().getCanonicalType(SrcType.getTypePtr()); in checkAddressSpaceCast()
2666 Self.Diag(OpRange.getBegin(), DiagID) in checkAddressSpaceCast()
2710 assert(Self.getLangOpts().CPlusPlus); in CheckCXXCStyleCast()
2716 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCXXCStyleCast()
2734 Self.ResolveAndFixSingleFunctionTemplateSpecialization( in CheckCXXCStyleCast()
2742 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckCXXCStyleCast()
2755 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckCXXCStyleCast()
2762 if (Self.CheckAltivecInitFromScalar(OpRange, DestType, in CheckCXXCStyleCast()
2767 if (Self.ShouldSplatAltivecScalarInCast(vecTy) && in CheckCXXCStyleCast()
2771 SrcExpr = Self.prepareVectorSplat(DestType, SrcExpr.get()); in CheckCXXCStyleCast()
2779 Self.Diag(OpRange.getBegin(), diag::err_wasm_cast_table) in CheckCXXCStyleCast()
2798 TryCastResult tcr = TryConstCast(Self, SrcExpr, DestType, in CheckCXXCStyleCast()
2808 tcr = TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ true, msg, in CheckCXXCStyleCast()
2816 tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange, msg, Kind, in CheckCXXCStyleCast()
2823 tcr = TryReinterpretCast(Self, SrcExpr, DestType, /*CStyle*/ true, in CheckCXXCStyleCast()
2831 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() && in CheckCXXCStyleCast()
2836 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCXXCStyleCast()
2838 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in CheckCXXCStyleCast()
2847 Self.Diag(OpRange.getBegin(), diag::err_bad_cstyle_cast_overload) in CheckCXXCStyleCast()
2850 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckCXXCStyleCast()
2853 diagnoseBadCast(Self, msg, (FunctionalStyle ? CT_Functional : CT_CStyle), in CheckCXXCStyleCast()
2862 if (unsigned DiagID = checkCastFunctionType(Self, SrcExpr, DestType)) in CheckCXXCStyleCast()
2863 Self.Diag(OpRange.getBegin(), DiagID) in CheckCXXCStyleCast()
2874 static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseBadFunctionCast() argument
2876 if (Self.Diags.isIgnored(diag::warn_bad_function_cast, in DiagnoseBadFunctionCast()
2904 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseBadFunctionCast()
2911 assert(!Self.getLangOpts().CPlusPlus); in CheckCStyleCast()
2915 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCStyleCast()
2925 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckCStyleCast()
2935 if (Self.getASTContext().isDependenceAllowed() && in CheckCStyleCast()
2946 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCStyleCast()
2948 if (FunctionDecl *FD = Self.ResolveAddressOfOverloadedFunction( in CheckCStyleCast()
2950 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr.get(), DAP, FD); in CheckCStyleCast()
2955 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckCStyleCast()
2961 Self.Diag(OpRange.getBegin(), diag::err_wasm_cast_table) in CheckCStyleCast()
2973 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in CheckCStyleCast()
2981 Self.Context.hasSameUnqualifiedType(DestType, SrcType)) { in CheckCStyleCast()
2988 Self.isValidSveBitcast(SrcType, DestType)) { in CheckCStyleCast()
2995 Self.isValidRVVBitcast(SrcType, DestType)) { in CheckCStyleCast()
3004 if (DestRecordTy && Self.Context.hasSameUnqualifiedType(DestType, SrcType)){ in CheckCStyleCast()
3006 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_nonscalar) in CheckCStyleCast()
3016 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union) in CheckCStyleCast()
3021 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cast_to_union_no_type) in CheckCStyleCast()
3029 if (Self.getLangOpts().OpenCL && DestType->isEventT()) { in CheckCStyleCast()
3031 if (SrcExpr.get()->EvaluateAsInt(Result, Self.Context)) { in CheckCStyleCast()
3037 Self.Diag(OpRange.getBegin(), in CheckCStyleCast()
3046 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cond_expect_scalar) in CheckCStyleCast()
3057 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
3074 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast) in CheckCStyleCast()
3083 SrcExpr = ImplicitCastExpr::Create(Self.Context, DestType, CK, in CheckCStyleCast()
3085 Self.CurFPFeatureOverrides()); in CheckCStyleCast()
3089 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast) in CheckCStyleCast()
3096 SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.get(), Kind); in CheckCStyleCast()
3101 if (Self.CheckMatrixCast(OpRange, DestType, SrcType, Kind)) in CheckCStyleCast()
3107 if (Self.CheckAltivecInitFromScalar(OpRange, DestType, SrcType)) { in CheckCStyleCast()
3111 if (Self.ShouldSplatAltivecScalarInCast(DestVecTy) && in CheckCStyleCast()
3114 SrcExpr = Self.prepareVectorSplat(DestType, SrcExpr.get()); in CheckCStyleCast()
3115 } else if (Self.CheckVectorCast(OpRange, DestType, SrcType, Kind)) { in CheckCStyleCast()
3122 if (Self.CheckVectorCast(OpRange, SrcType, DestType, Kind)) in CheckCStyleCast()
3133 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_selector_expr); in CheckCStyleCast()
3141 if (!SrcType->isIntegralType(Self.Context) && SrcType->isArithmeticType()) { in CheckCStyleCast()
3142 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
3149 Self); in CheckCStyleCast()
3151 if (!DestType->isIntegralType(Self.Context) && in CheckCStyleCast()
3153 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3160 if ((Self.Context.getTypeSize(SrcType) > in CheckCStyleCast()
3161 Self.Context.getTypeSize(DestType)) && in CheckCStyleCast()
3176 Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; in CheckCStyleCast()
3180 if (Self.getLangOpts().OpenCL && !Self.getOpenCLOptions().isAvailableOption( in CheckCStyleCast()
3181 "cl_khr_fp16", Self.getLangOpts())) { in CheckCStyleCast()
3183 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_opencl_cast_to_half) in CheckCStyleCast()
3191 if (Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) { in CheckCStyleCast()
3197 if (Self.getLangOpts().ObjCAutoRefCount && CastPtr) { in CheckCStyleCast()
3204 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3212 else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) { in CheckCStyleCast()
3213 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
3221 if (unsigned DiagID = checkCastFunctionType(Self, SrcExpr, DestType)) in CheckCStyleCast()
3222 Self.Diag(OpRange.getBegin(), DiagID) << SrcType << DestType << OpRange; in CheckCStyleCast()
3234 Self.Diag(OpRange.getBegin(), diag::err_cast_from_randomized_struct) in CheckCStyleCast()
3241 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in CheckCStyleCast()
3242 DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange); in CheckCStyleCast()
3243 DiagnoseBadFunctionCast(Self, SrcExpr, DestType); in CheckCStyleCast()
3244 Kind = Self.PrepareScalarCast(SrcExpr, DestType); in CheckCStyleCast()
3255 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in CheckBuiltinBitCast()
3257 Self.RequireCompleteType(OpRange.getBegin(), SrcType, in CheckBuiltinBitCast()
3264 SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcType, SrcExpr.get(), in CheckBuiltinBitCast()
3267 CharUnits DestSize = Self.Context.getTypeSizeInChars(DestType); in CheckBuiltinBitCast()
3268 CharUnits SourceSize = Self.Context.getTypeSizeInChars(SrcType); in CheckBuiltinBitCast()
3270 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_type_size_mismatch) in CheckBuiltinBitCast()
3276 if (!DestType.isTriviallyCopyableType(Self.Context)) { in CheckBuiltinBitCast()
3277 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_non_trivially_copyable) in CheckBuiltinBitCast()
3283 if (!SrcType.isTriviallyCopyableType(Self.Context)) { in CheckBuiltinBitCast()
3284 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_non_trivially_copyable) in CheckBuiltinBitCast()
3295 static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastQual() argument
3307 if (CastsAwayConstness(Self, SrcType, DestType, true, false, in DiagnoseCastQual()
3324 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual2) in DiagnoseCastQual()
3327 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual) in DiagnoseCastQual()
3350 DiagnoseCastQual(Op.Self, Op.SrcExpr, Op.DestType); in BuildCStyleCastExpr()
3378 DiagnoseCastQual(Op.Self, Op.SrcExpr, Op.DestType); in BuildCXXFunctionalCastExpr()