Lines Matching refs:SrcExpr

58       : Self(S), SrcExpr(src), DestType(destType),  in CastOperation()
72 ExprResult SrcExpr; member
138 Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange); in checkCastAlign()
144 Expr *src = SrcExpr.get(); in checkObjCConversion()
148 SrcExpr = src; in checkObjCConversion()
156 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in checkNonOverloadPlaceholders()
157 if (SrcExpr.isInvalid()) in checkNonOverloadPlaceholders()
164 static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr,
178 static TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr,
183 static TryCastResult TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr,
202 static TryCastResult TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr,
210 static TryCastResult TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr,
216 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
223 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr,
226 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
278 if (Op.SrcExpr.isInvalid()) in BuildCXXNamedCast()
283 Op.ValueKind, Op.SrcExpr.get(), DestTInfo, in BuildCXXNamedCast()
296 if (Op.SrcExpr.isInvalid()) in BuildCXXNamedCast()
300 Op.ValueKind, Op.Kind, Op.SrcExpr.get(), in BuildCXXNamedCast()
308 if (Op.SrcExpr.isInvalid()) in BuildCXXNamedCast()
313 Op.ValueKind, Op.Kind, Op.SrcExpr.get(), in BuildCXXNamedCast()
321 if (Op.SrcExpr.isInvalid()) in BuildCXXNamedCast()
327 Op.ValueKind, Op.Kind, Op.SrcExpr.get(), in BuildCXXNamedCast()
680 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckDynamicCast()
682 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in CheckDynamicCast()
683 if (SrcExpr.isInvalid()) // if conversion failed, don't report another error in CheckDynamicCast()
686 QualType OrigSrcType = SrcExpr.get()->getType(); in CheckDynamicCast()
702 SrcExpr = ExprError(); in CheckDynamicCast()
713 SrcExpr = ExprError(); in CheckDynamicCast()
719 SrcExpr = ExprError(); in CheckDynamicCast()
734 << OrigSrcType << SrcExpr.get()->getSourceRange(); in CheckDynamicCast()
735 SrcExpr = ExprError(); in CheckDynamicCast()
739 if (!SrcExpr.get()->isLValue()) { in CheckDynamicCast()
747 if (SrcExpr.get()->isRValue()) in CheckDynamicCast()
748 SrcExpr = Self.CreateMaterializeTemporaryExpr( in CheckDynamicCast()
749 SrcType, SrcExpr.get(), /*IsLValueReference*/ false); in CheckDynamicCast()
757 SrcExpr.get())) { in CheckDynamicCast()
758 SrcExpr = ExprError(); in CheckDynamicCast()
763 << SrcPointee.getUnqualifiedType() << SrcExpr.get()->getSourceRange(); in CheckDynamicCast()
764 SrcExpr = ExprError(); in CheckDynamicCast()
778 SrcExpr = ExprError(); in CheckDynamicCast()
796 SrcExpr = ExprError(); in CheckDynamicCast()
809 << SrcPointee.getUnqualifiedType() << SrcExpr.get()->getSourceRange(); in CheckDynamicCast()
810 SrcExpr = ExprError(); in CheckDynamicCast()
818 SrcExpr = ExprError(); in CheckDynamicCast()
833 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckConstCast()
835 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get()); in CheckConstCast()
836 if (SrcExpr.isInvalid()) // if conversion failed, don't report another error in CheckConstCast()
840 auto TCR = TryConstCast(Self, SrcExpr, DestType, /*CStyle*/ false, msg); in CheckConstCast()
843 << SrcExpr.get()->getType() << DestType << OpRange; in CheckConstCast()
846 SrcExpr = ExprError(); in CheckConstCast()
851 static void DiagnoseReinterpretUpDownCast(Sema &Self, const Expr *SrcExpr, in DiagnoseReinterpretUpDownCast() argument
854 QualType SrcType = SrcExpr->getType(); in DiagnoseReinterpretUpDownCast()
949 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckReinterpretCast()
952 if (SrcExpr.isInvalid()) // if conversion failed, don't report another error in CheckReinterpretCast()
957 TryReinterpretCast(Self, SrcExpr, DestType, in CheckReinterpretCast()
960 if (SrcExpr.isInvalid()) // if conversion failed, don't report another error in CheckReinterpretCast()
962 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckReinterpretCast()
965 << OverloadExpr::find(SrcExpr.get()).Expression->getName() in CheckReinterpretCast()
967 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckReinterpretCast()
970 diagnoseBadCast(Self, msg, CT_Reinterpret, OpRange, SrcExpr.get(), in CheckReinterpretCast()
978 DiagnoseReinterpretUpDownCast(Self, SrcExpr.get(), DestType, OpRange); in CheckReinterpretCast()
980 SrcExpr = ExprError(); in CheckReinterpretCast()
991 if (SrcExpr.isInvalid()) in CheckStaticCast()
1002 Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr, in CheckStaticCast()
1006 if (SrcExpr.isInvalid()) in CheckStaticCast()
1010 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckStaticCast()
1016 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckStaticCast()
1017 if (SrcExpr.isInvalid()) // if conversion failed, don't report another error in CheckStaticCast()
1023 = TryStaticCast(Self, SrcExpr, DestType, Sema::CCK_OtherCast, OpRange, msg, in CheckStaticCast()
1026 if (SrcExpr.isInvalid()) in CheckStaticCast()
1028 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckStaticCast()
1029 OverloadExpr* oe = OverloadExpr::find(SrcExpr.get()).Expression; in CheckStaticCast()
1033 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckStaticCast()
1035 diagnoseBadCast(Self, msg, CT_Static, OpRange, SrcExpr.get(), DestType, in CheckStaticCast()
1046 SrcExpr = ExprError(); in CheckStaticCast()
1064 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr, in TryStaticCast() argument
1094 tcr = TryStaticReferenceDowncast(Self, SrcExpr.get(), DestType, CStyle, in TryStaticCast()
1102 tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind, in TryStaticCast()
1109 tcr = TryStaticImplicitCast(Self, SrcExpr, DestType, CCK, OpRange, msg, in TryStaticCast()
1111 if (SrcExpr.isInvalid()) in TryStaticCast()
1124 QualType SrcType = Self.Context.getCanonicalType(SrcExpr.get()->getType()); in TryStaticCast()
1172 tcr = TryStaticMemberPointerUpcast(Self, SrcExpr, SrcType, DestType, CStyle, in TryStaticCast()
1239 Self.CheckTollFreeBridgeStaticCast(DestType, SrcExpr.get(), Kind)) in TryStaticCast()
1255 TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, in TryLValueToRValueCast() argument
1266 if (!SrcExpr->isGLValue()) in TryLValueToRValueCast()
1275 QualType FromType = SrcExpr->getType(); in TryLValueToRValueCast()
1283 SrcExpr->getBeginLoc(), ToType, FromType, DerivedToBase, ObjCConversion, in TryLValueToRValueCast()
1291 msg = SrcExpr->isLValue() ? diag::err_bad_lvalue_to_rvalue_cast in TryLValueToRValueCast()
1300 if (!Self.IsDerivedFrom(SrcExpr->getBeginLoc(), SrcExpr->getType(), in TryLValueToRValueCast()
1313 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType, in TryStaticReferenceDowncast() argument
1331 if (!RValueRef && !SrcExpr->isLValue()) { in TryStaticReferenceDowncast()
1343 Self.Context.getCanonicalType(SrcExpr->getType()), in TryStaticReferenceDowncast()
1345 OpRange, SrcExpr->getType(), DestType, msg, Kind, in TryStaticReferenceDowncast()
1497 TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType, in TryStaticMemberPointerUpcast() argument
1508 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in TryStaticMemberPointerUpcast()
1510 = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), DestType, false, in TryStaticMemberPointerUpcast()
1588 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in TryStaticMemberPointerUpcast()
1597 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr, FoundOverload, Fn); in TryStaticMemberPointerUpcast()
1598 if (!SrcExpr.isUsable()) { in TryStaticMemberPointerUpcast()
1615 TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, in TryStaticImplicitCast() argument
1637 Expr *SrcExprRaw = SrcExpr.get(); in TryStaticImplicitCast()
1664 SrcExpr = Result; in TryStaticImplicitCast()
1670 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr, in TryConstCast() argument
1674 QualType SrcType = SrcExpr.get()->getType(); in TryConstCast()
1689 if (isa<LValueReferenceType>(DestTypeTmp) && !SrcExpr.get()->isLValue()) { in TryConstCast()
1697 if (isa<RValueReferenceType>(DestTypeTmp) && SrcExpr.get()->isRValue()) { in TryConstCast()
1715 if (SrcExpr.get()->refersToBitField()) { in TryConstCast()
1761 SrcExpr = Self.CreateMaterializeTemporaryExpr(SrcExpr.get()->getType(), in TryConstCast()
1762 SrcExpr.get(), in TryConstCast()
1823 static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastOfObjCSEL() argument
1825 QualType SrcType = SrcExpr.get()->getType(); in DiagnoseCastOfObjCSEL()
1834 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseCastOfObjCSEL()
1836 << SrcType << DestType << SrcExpr.get()->getSourceRange(); in DiagnoseCastOfObjCSEL()
1842 static void DiagnoseCallingConvCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCallingConvCast() argument
1846 QualType SrcType = SrcExpr.get()->getType(); in DiagnoseCallingConvCast()
1861 Expr *Src = SrcExpr.get()->IgnoreParenImpCasts(); in DiagnoseCallingConvCast()
1931 const Expr *SrcExpr, QualType DestType, in checkIntToPointerCast() argument
1933 QualType SrcType = SrcExpr->getType(); in checkIntToPointerCast()
1941 && !SrcExpr->isIntegerConstantExpr(Self.Context) in checkIntToPointerCast()
1983 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, in TryReinterpretCast() argument
1991 QualType SrcType = SrcExpr.get()->getType(); in TryReinterpretCast()
1996 ExprResult FixedExpr = SrcExpr; in TryReinterpretCast()
2001 SrcExpr = FixedExpr; in TryReinterpretCast()
2002 SrcType = SrcExpr.get()->getType(); in TryReinterpretCast()
2006 if (!SrcExpr.get()->isGLValue()) { in TryReinterpretCast()
2023 switch (SrcExpr.get()->getObjectKind()) { in TryReinterpretCast()
2038 << OpRange << SrcExpr.get()->getSourceRange(); in TryReinterpretCast()
2039 msg = 0; SrcExpr = ExprError(); in TryReinterpretCast()
2187 checkIntToPointerCast(CStyle, OpRange.getBegin(), SrcExpr.get(), DestType, in TryReinterpretCast()
2219 Kind = Self.PrepareCastToObjCObjectPointer(SrcExpr); in TryReinterpretCast()
2238 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in TryReinterpretCast()
2240 DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange); in TryReinterpretCast()
2297 << SrcExpr.get()->getSourceRange(); in checkAddressSpaceCast()
2298 SrcExpr = ExprError(); in checkAddressSpaceCast()
2311 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCXXCStyleCast()
2312 SrcExpr.get(), Kind, in CheckCXXCStyleCast()
2318 if (SrcExpr.isInvalid()) in CheckCXXCStyleCast()
2330 SrcExpr, /* Decay Function to ptr */ false, in CheckCXXCStyleCast()
2333 if (SrcExpr.isInvalid()) in CheckCXXCStyleCast()
2337 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckCXXCStyleCast()
2342 if (DestType->isDependentType() || SrcExpr.get()->isTypeDependent() || in CheckCXXCStyleCast()
2343 SrcExpr.get()->isValueDependent()) { in CheckCXXCStyleCast()
2350 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckCXXCStyleCast()
2351 if (SrcExpr.isInvalid()) in CheckCXXCStyleCast()
2358 && (SrcExpr.get()->getType()->isIntegerType() in CheckCXXCStyleCast()
2359 || SrcExpr.get()->getType()->isFloatingType())) { in CheckCXXCStyleCast()
2361 SrcExpr = Self.prepareVectorSplat(DestType, SrcExpr.get()); in CheckCXXCStyleCast()
2377 TryCastResult tcr = TryConstCast(Self, SrcExpr, DestType, in CheckCXXCStyleCast()
2379 if (SrcExpr.isInvalid()) in CheckCXXCStyleCast()
2389 tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange, in CheckCXXCStyleCast()
2391 if (SrcExpr.isInvalid()) in CheckCXXCStyleCast()
2396 tcr = TryReinterpretCast(Self, SrcExpr, DestType, /*CStyle*/true, in CheckCXXCStyleCast()
2398 if (SrcExpr.isInvalid()) in CheckCXXCStyleCast()
2408 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCXXCStyleCast()
2410 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in CheckCXXCStyleCast()
2418 OverloadExpr *OE = OverloadExpr::find(SrcExpr.get()).Expression; in CheckCXXCStyleCast()
2422 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckCXXCStyleCast()
2426 OpRange, SrcExpr.get(), DestType, ListInitialization); in CheckCXXCStyleCast()
2430 checkAddressSpaceCast(SrcExpr.get()->getType(), DestType); in CheckCXXCStyleCast()
2436 SrcExpr = ExprError(); in CheckCXXCStyleCast()
2443 static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseBadFunctionCast() argument
2446 SrcExpr.get()->getExprLoc())) in DiagnoseBadFunctionCast()
2449 if (!isa<CallExpr>(SrcExpr.get())) in DiagnoseBadFunctionCast()
2452 QualType SrcType = SrcExpr.get()->getType(); in DiagnoseBadFunctionCast()
2471 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseBadFunctionCast()
2473 << SrcType << DestType << SrcExpr.get()->getSourceRange(); in DiagnoseBadFunctionCast()
2482 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCStyleCast()
2483 SrcExpr.get(), Kind, in CheckCStyleCast()
2492 SrcExpr = Self.IgnoredValueConversions(SrcExpr.get()); in CheckCStyleCast()
2493 if (SrcExpr.isInvalid()) in CheckCStyleCast()
2502 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCStyleCast()
2505 SrcExpr.get(), DestType, /*Complain=*/true, DAP)) in CheckCStyleCast()
2506 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr.get(), DAP, FD); in CheckCStyleCast()
2509 assert(SrcExpr.isUsable()); in CheckCStyleCast()
2511 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get()); in CheckCStyleCast()
2512 if (SrcExpr.isInvalid()) in CheckCStyleCast()
2514 QualType SrcType = SrcExpr.get()->getType(); in CheckCStyleCast()
2519 if (SrcExpr.isInvalid()) in CheckCStyleCast()
2524 SrcExpr = ExprError(); in CheckCStyleCast()
2534 << DestType << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2544 << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2549 << SrcType << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2550 SrcExpr = ExprError(); in CheckCStyleCast()
2558 if (SrcExpr.get()->EvaluateAsInt(Result, Self.Context)) { in CheckCStyleCast()
2566 << CastInt.toString(10) << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2567 SrcExpr = ExprError(); in CheckCStyleCast()
2574 << DestType << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2575 SrcExpr = ExprError(); in CheckCStyleCast()
2583 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
2585 << SrcType << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2586 SrcExpr = ExprError(); in CheckCStyleCast()
2591 SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.get(), Kind); in CheckCStyleCast()
2599 SrcExpr = Self.prepareVectorSplat(DestType, SrcExpr.get()); in CheckCStyleCast()
2601 SrcExpr = ExprError(); in CheckCStyleCast()
2608 SrcExpr = ExprError(); in CheckCStyleCast()
2617 if (isa<ObjCSelectorExpr>(SrcExpr.get())) { in CheckCStyleCast()
2618 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_selector_expr); in CheckCStyleCast()
2619 SrcExpr = ExprError(); in CheckCStyleCast()
2627 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
2629 << SrcType << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2630 SrcExpr = ExprError(); in CheckCStyleCast()
2633 checkIntToPointerCast(/* CStyle */ true, OpRange.getBegin(), SrcExpr.get(), in CheckCStyleCast()
2638 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
2640 << DestType << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2641 SrcExpr = ExprError(); in CheckCStyleCast()
2649 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_opencl_cast_to_half) in CheckCStyleCast()
2650 << DestType << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2651 SrcExpr = ExprError(); in CheckCStyleCast()
2659 if (SrcExpr.isInvalid()) in CheckCStyleCast()
2670 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
2673 << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2679 Self.Diag(SrcExpr.get()->getBeginLoc(), in CheckCStyleCast()
2681 << 1 << SrcType << DestType << SrcExpr.get()->getSourceRange(); in CheckCStyleCast()
2682 SrcExpr = ExprError(); in CheckCStyleCast()
2687 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in CheckCStyleCast()
2688 DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange); in CheckCStyleCast()
2689 DiagnoseBadFunctionCast(Self, SrcExpr, DestType); in CheckCStyleCast()
2690 Kind = Self.PrepareScalarCast(SrcExpr, DestType); in CheckCStyleCast()
2691 if (SrcExpr.isInvalid()) in CheckCStyleCast()
2700 static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastQual() argument
2702 if (SrcExpr.isInvalid()) in DiagnoseCastQual()
2705 QualType SrcType = SrcExpr.get()->getType(); in DiagnoseCastQual()
2729 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual2) in DiagnoseCastQual()
2732 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual) in DiagnoseCastQual()
2751 if (Op.SrcExpr.isInvalid()) in BuildCStyleCastExpr()
2755 DiagnoseCastQual(Op.Self, Op.SrcExpr, Op.DestType); in BuildCStyleCastExpr()
2758 Op.ValueKind, Op.Kind, Op.SrcExpr.get(), in BuildCStyleCastExpr()
2773 if (Op.SrcExpr.isInvalid()) in BuildCXXFunctionalCastExpr()
2776 auto *SubExpr = Op.SrcExpr.get(); in BuildCXXFunctionalCastExpr()
2784 Op.SrcExpr.get(), &Op.BasePath, LPLoc, RPLoc)); in BuildCXXFunctionalCastExpr()