Lines Matching refs:Self

50       : Self(S), SrcExpr(src), DestType(destType),  in CastOperation()
63 Sema &Self; member
90 castExpr = ImplicitCastExpr::Create(Self.Context, in complete()
91 Self.Context.ARCUnbridgedCastTy, in complete()
95 return Self.Owned(castExpr); in complete()
118 Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange); in checkCastAlign()
122 assert(Self.getLangOpts().ObjCAutoRefCount); in checkObjCARCConversion()
125 if (Self.CheckObjCARCConversion(OpRange, DestType, src, CCK) == in checkObjCARCConversion()
136 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take()); in checkNonOverloadPlaceholders()
144 static bool CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
158 static TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr,
163 static TryCastResult TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr,
169 static TryCastResult TryStaticPointerDowncast(Sema &Self, QualType SrcType,
175 static TryCastResult TryStaticDowncast(Sema &Self, CanQualType SrcType,
182 static TryCastResult TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr,
190 static TryCastResult TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr,
196 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
203 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr,
206 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
463 CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, in CastsAwayConstness() argument
468 !Self.Context.getLangOpts().ObjCAutoRefCount) in CastsAwayConstness()
482 QualType UnwrappedSrcType = Self.Context.getCanonicalType(SrcType), in CastsAwayConstness()
483 UnwrappedDestType = Self.Context.getCanonicalType(DestType); in CastsAwayConstness()
492 Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals); in CastsAwayConstness()
493 Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals); in CastsAwayConstness()
513 QualType SrcConstruct = Self.Context.VoidTy; in CastsAwayConstness()
514 QualType DestConstruct = Self.Context.VoidTy; in CastsAwayConstness()
515 ASTContext &Context = Self.Context; in CastsAwayConstness()
528 !Self.IsQualificationConversion(SrcConstruct, DestConstruct, false, in CastsAwayConstness()
537 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take()); in CheckDynamicCast()
539 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take()); in CheckDynamicCast()
544 QualType DestType = Self.Context.getCanonicalType(this->DestType); in CheckDynamicCast()
557 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ref_or_ptr) in CheckDynamicCast()
567 if (Self.RequireCompleteType(OpRange.getBegin(), DestPointee, in CheckDynamicCast()
574 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) in CheckDynamicCast()
584 QualType SrcType = Self.Context.getCanonicalType(OrigSrcType); in CheckDynamicCast()
590 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ptr) in CheckDynamicCast()
597 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue) in CheckDynamicCast()
607 if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee, in CheckDynamicCast()
614 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) in CheckDynamicCast()
628 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_qualifiers_away) in CheckDynamicCast()
643 if (DestRecord && Self.IsDerivedFrom(SrcPointee, DestPointee)) { in CheckDynamicCast()
644 if (Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee, in CheckDynamicCast()
655 if (Self.BasePathInvolvesVirtualBase(BasePath)) in CheckDynamicCast()
656 Self.MarkVTableUsed(OpRange.getBegin(), in CheckDynamicCast()
665 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic) in CheckDynamicCast()
669 Self.MarkVTableUsed(OpRange.getBegin(), in CheckDynamicCast()
675 if (!Self.getLangOpts().RTTI && !DestPointee->isVoidType()) { in CheckDynamicCast()
676 Self.Diag(OpRange.getBegin(), diag::err_no_dynamic_cast_with_fno_rtti); in CheckDynamicCast()
692 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take()); in CheckConstCast()
694 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take()); in CheckConstCast()
699 if (TryConstCast(Self, SrcExpr, DestType, /*CStyle*/false, msg) != TC_Success in CheckConstCast()
701 Self.Diag(OpRange.getBegin(), msg) << CT_Const in CheckConstCast()
709 static void DiagnoseReinterpretUpDownCast(Sema &Self, const Expr *SrcExpr, in DiagnoseReinterpretUpDownCast() argument
768 Self.Context.getASTRecordLayout(Class); in DiagnoseReinterpretUpDownCast()
792 Self.Diag(BeginLoc, diag::warn_reinterpret_different_from_static) in DiagnoseReinterpretUpDownCast()
795 Self.Diag(BeginLoc, diag::note_reinterpret_updowncast_use_static) in DiagnoseReinterpretUpDownCast()
807 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take()); in CheckReinterpretCast()
815 TryReinterpretCast(Self, SrcExpr, DestType, in CheckReinterpretCast()
821 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckReinterpretCast()
823 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_overload) in CheckReinterpretCast()
826 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckReinterpretCast()
829 diagnoseBadCast(Self, msg, CT_Reinterpret, OpRange, SrcExpr.get(), in CheckReinterpretCast()
834 if (Self.getLangOpts().ObjCAutoRefCount) in CheckReinterpretCast()
836 DiagnoseReinterpretUpDownCast(Self, SrcExpr.get(), DestType, OpRange); in CheckReinterpretCast()
858 Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr, in CheckStaticCast()
866 SrcExpr = Self.IgnoredValueConversions(SrcExpr.take()); in CheckStaticCast()
872 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take()); in CheckStaticCast()
879 = TryStaticCast(Self, SrcExpr, DestType, Sema::CCK_OtherCast, OpRange, msg, in CheckStaticCast()
884 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckStaticCast()
886 Self.Diag(OpRange.getBegin(), diag::err_bad_static_cast_overload) in CheckStaticCast()
889 Self.NoteAllOverloadCandidates(SrcExpr.get()); in CheckStaticCast()
891 diagnoseBadCast(Self, msg, CT_Static, OpRange, SrcExpr.get(), DestType, in CheckStaticCast()
898 if (Self.getLangOpts().ObjCAutoRefCount) in CheckStaticCast()
908 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr, in TryStaticCast() argument
938 tcr = TryStaticReferenceDowncast(Self, SrcExpr.get(), DestType, CStyle, in TryStaticCast()
946 tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind, in TryStaticCast()
953 tcr = TryStaticImplicitCast(Self, SrcExpr, DestType, CCK, OpRange, msg, in TryStaticCast()
968 QualType SrcType = Self.Context.getCanonicalType(SrcExpr.get()->getType()); in TryStaticCast()
978 } else if (DestType->isIntegralType(Self.Context)) { in TryStaticCast()
1008 tcr = TryStaticPointerDowncast(Self, SrcType, DestType, CStyle, OpRange, msg, in TryStaticCast()
1016 tcr = TryStaticMemberPointerUpcast(Self, SrcExpr, SrcType, DestType, CStyle, in TryStaticCast()
1076 TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType, in TryLValueToRValueCast() argument
1102 if (Self.CompareReferenceRelationship(SrcExpr->getLocStart(), in TryLValueToRValueCast()
1115 if (!Self.IsDerivedFrom(SrcExpr->getType(), R->getPointeeType(), Paths)) in TryLValueToRValueCast()
1118 Self.BuildBasePathArray(Paths, BasePath); in TryLValueToRValueCast()
1127 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType, in TryStaticReferenceDowncast() argument
1153 return TryStaticDowncast(Self, in TryStaticReferenceDowncast()
1154 Self.Context.getCanonicalType(SrcExpr->getType()), in TryStaticReferenceDowncast()
1155 Self.Context.getCanonicalType(DestPointee), CStyle, in TryStaticReferenceDowncast()
1162 TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType, in TryStaticPointerDowncast() argument
1185 return TryStaticDowncast(Self, in TryStaticPointerDowncast()
1186 Self.Context.getCanonicalType(SrcPointer->getPointeeType()), in TryStaticPointerDowncast()
1187 Self.Context.getCanonicalType(DestPointer->getPointeeType()), in TryStaticPointerDowncast()
1196 TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType, in TryStaticDowncast() argument
1201 if (Self.RequireCompleteType(OpRange.getBegin(), SrcType, 0) || in TryStaticDowncast()
1202 Self.RequireCompleteType(OpRange.getBegin(), DestType, 0)) in TryStaticDowncast()
1212 if (!Self.IsDerivedFrom(DestType, SrcType, Paths)) { in TryStaticDowncast()
1248 Self.IsDerivedFrom(DestType, SrcType, Paths); in TryStaticDowncast()
1266 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_base_to_derived_cast) in TryStaticDowncast()
1276 Self.Diag(OpRange.getBegin(), diag::err_static_downcast_via_virtual) in TryStaticDowncast()
1283 switch (Self.CheckBaseClassAccess(OpRange.getBegin(), in TryStaticDowncast()
1298 Self.BuildBasePathArray(Paths, BasePath); in TryStaticDowncast()
1311 TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType, in TryStaticMemberPointerUpcast() argument
1322 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in TryStaticMemberPointerUpcast()
1324 = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), DestType, false, in TryStaticMemberPointerUpcast()
1327 SrcType = Self.Context.getMemberPointerType(Fn->getType(), in TryStaticMemberPointerUpcast()
1328 Self.Context.getTypeDeclType(M->getParent()).getTypePtr()); in TryStaticMemberPointerUpcast()
1340 if (!Self.Context.hasSameUnqualifiedType(SrcMemPtr->getPointeeType(), in TryStaticMemberPointerUpcast()
1349 if (!Self.IsDerivedFrom(SrcClass, DestClass, Paths)) { in TryStaticMemberPointerUpcast()
1354 if (Paths.isAmbiguous(Self.Context.getCanonicalType(DestClass))) { in TryStaticMemberPointerUpcast()
1357 bool StillOkay = Self.IsDerivedFrom(SrcClass, DestClass, Paths); in TryStaticMemberPointerUpcast()
1360 std::string PathDisplayStr = Self.getAmbiguousPathsDisplayString(Paths); in TryStaticMemberPointerUpcast()
1361 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_memptr_conv) in TryStaticMemberPointerUpcast()
1368 Self.Diag(OpRange.getBegin(), diag::err_memptr_conv_via_virtual) in TryStaticMemberPointerUpcast()
1375 switch (Self.CheckBaseClassAccess(OpRange.getBegin(), in TryStaticMemberPointerUpcast()
1395 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in TryStaticMemberPointerUpcast()
1404 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr, FoundOverload, Fn); in TryStaticMemberPointerUpcast()
1411 Self.BuildBasePathArray(Paths, BasePath); in TryStaticMemberPointerUpcast()
1422 TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, in TryStaticImplicitCast() argument
1427 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in TryStaticImplicitCast()
1429 Self.RequireNonAbstractType(OpRange.getBegin(), DestType, in TryStaticImplicitCast()
1445 InitializationSequence InitSeq(Self, Entity, InitKind, SrcExprRaw); in TryStaticImplicitCast()
1457 ExprResult Result = InitSeq.Perform(Self, Entity, InitKind, SrcExprRaw); in TryStaticImplicitCast()
1474 static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr, in TryConstCast() argument
1477 DestType = Self.Context.getCanonicalType(DestType); in TryConstCast()
1524 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType()); in TryConstCast()
1525 SrcType = Self.Context.getPointerType(SrcType); in TryConstCast()
1552 SrcType = Self.Context.getCanonicalType(SrcType); in TryConstCast()
1560 Self.Context.UnwrapSimilarPointerTypes(SrcType, DestType)) { in TryConstCast()
1562 SrcType = Self.Context.getUnqualifiedArrayType(SrcType, SrcQuals); in TryConstCast()
1563 DestType = Self.Context.getUnqualifiedArrayType(DestType, DestQuals); in TryConstCast()
1580 SrcExpr = new (Self.Context) MaterializeTemporaryExpr( in TryConstCast()
1644 static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr, in DiagnoseCastOfObjCSEL() argument
1647 if (Self.Context.hasSameType(SrcType, DestType)) in DiagnoseCastOfObjCSEL()
1655 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseCastOfObjCSEL()
1663 Sema &Self) { in checkIntToPointerCast() argument
1669 if (CStyle && SrcType->isIntegralType(Self.Context) in checkIntToPointerCast()
1672 && !SrcExpr->isIntegerConstantExpr(Self.Context) in checkIntToPointerCast()
1673 && Self.Context.getTypeSize(DestType) > in checkIntToPointerCast()
1674 Self.Context.getTypeSize(SrcType)) { in checkIntToPointerCast()
1683 Self.Diag(Loc, Diag) << SrcType << DestType; in checkIntToPointerCast()
1687 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, in TryReinterpretCast() argument
1694 DestType = Self.Context.getCanonicalType(DestType); in TryReinterpretCast()
1699 if (SrcType == Self.Context.OverloadTy) { in TryReinterpretCast()
1704 if (Self.ResolveAndFixSingleFunctionTemplateSpecialization( in TryReinterpretCast()
1724 Self.CheckCompatibleReinterpretCast(SrcType, DestType, in TryReinterpretCast()
1743 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_reference) in TryReinterpretCast()
1751 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType()); in TryReinterpretCast()
1752 SrcType = Self.Context.getPointerType(SrcType); in TryReinterpretCast()
1758 SrcType = Self.Context.getCanonicalType(SrcType); in TryReinterpretCast()
1775 if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle, in TryReinterpretCast()
1782 if (Self.Context.getTypeSize(DestMemPtr) != in TryReinterpretCast()
1783 Self.Context.getTypeSize(SrcMemPtr)) { in TryReinterpretCast()
1795 if (SrcType->isNullPtrType() && DestType->isIntegralType(Self.Context)) { in TryReinterpretCast()
1800 if (Self.Context.getTypeSize(SrcType) > in TryReinterpretCast()
1801 Self.Context.getTypeSize(DestType)) { in TryReinterpretCast()
1813 bool srcIsScalar = SrcType->isIntegralType(Self.Context); in TryReinterpretCast()
1814 bool destIsScalar = DestType->isIntegralType(Self.Context); in TryReinterpretCast()
1822 if (Self.Context.getTypeSize(SrcType) in TryReinterpretCast()
1823 == Self.Context.getTypeSize(DestType)) { in TryReinterpretCast()
1868 if (DestType->isIntegralType(Self.Context)) { in TryReinterpretCast()
1873 bool MicrosoftException = Self.getLangOpts().MicrosoftExt && in TryReinterpretCast()
1875 if ((Self.Context.getTypeSize(SrcType) > in TryReinterpretCast()
1876 Self.Context.getTypeSize(DestType)) && in TryReinterpretCast()
1888 Self); in TryReinterpretCast()
1905 if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle, in TryReinterpretCast()
1919 Kind = Self.PrepareCastToObjCObjectPointer(SrcExpr); in TryReinterpretCast()
1936 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in TryReinterpretCast()
1954 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
1955 Self.getLangOpts().CPlusPlus11 ? in TryReinterpretCast()
1963 Self.Diag(OpRange.getBegin(), in TryReinterpretCast()
1964 Self.getLangOpts().CPlusPlus11 ? in TryReinterpretCast()
1984 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCXXCStyleCast()
2002 Self.ResolveAndFixSingleFunctionTemplateSpecialization( in CheckCXXCStyleCast()
2010 SrcExpr = Self.IgnoredValueConversions(SrcExpr.take()); in CheckCXXCStyleCast()
2023 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take()); in CheckCXXCStyleCast()
2049 TryCastResult tcr = TryConstCast(Self, SrcExpr, DestType, in CheckCXXCStyleCast()
2061 tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange, in CheckCXXCStyleCast()
2068 tcr = TryReinterpretCast(Self, SrcExpr, DestType, /*CStyle*/true, in CheckCXXCStyleCast()
2075 if (Self.getLangOpts().ObjCAutoRefCount && tcr == TC_Success) in CheckCXXCStyleCast()
2079 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) { in CheckCXXCStyleCast()
2081 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), in CheckCXXCStyleCast()
2090 diagnoseBadCast(Self, msg, (FunctionalStyle ? CT_Functional : CT_CStyle), in CheckCXXCStyleCast()
2105 static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr, in DiagnoseBadFunctionCast() argument
2107 if (Self.Diags.getDiagnosticLevel(diag::warn_bad_function_cast, in DiagnoseBadFunctionCast()
2134 Self.Diag(SrcExpr.get()->getExprLoc(), in DiagnoseBadFunctionCast()
2141 assert(!Self.getLangOpts().CPlusPlus); in CheckCStyleCast()
2145 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType, in CheckCStyleCast()
2155 SrcExpr = Self.IgnoredValueConversions(SrcExpr.take()); in CheckCStyleCast()
2164 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take()); in CheckCStyleCast()
2171 if (Self.RequireCompleteType(OpRange.getBegin(), DestType, in CheckCStyleCast()
2180 if (DestRecordTy && Self.Context.hasSameUnqualifiedType(DestType, SrcType)){ in CheckCStyleCast()
2182 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_nonscalar) in CheckCStyleCast()
2194 if (Self.Context.hasSameUnqualifiedType(Field->getType(), SrcType) && in CheckCStyleCast()
2196 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union) in CheckCStyleCast()
2202 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cast_to_union_no_type) in CheckCStyleCast()
2212 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cond_expect_scalar) in CheckCStyleCast()
2222 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
2230 SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.take(), Kind); in CheckCStyleCast()
2238 } else if (Self.CheckVectorCast(OpRange, DestType, SrcType, Kind)) { in CheckCStyleCast()
2245 if (Self.CheckVectorCast(OpRange, SrcType, DestType, Kind)) in CheckCStyleCast()
2256 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_selector_expr); in CheckCStyleCast()
2264 if (!SrcType->isIntegralType(Self.Context) && SrcType->isArithmeticType()) { in CheckCStyleCast()
2265 Self.Diag(SrcExpr.get()->getExprLoc(), in CheckCStyleCast()
2272 DestType, Self); in CheckCStyleCast()
2274 if (!DestType->isIntegralType(Self.Context) && in CheckCStyleCast()
2276 Self.Diag(SrcExpr.get()->getLocStart(), in CheckCStyleCast()
2284 if (Self.getLangOpts().OpenCL && !Self.getOpenCLOptions().cl_khr_fp16) { in CheckCStyleCast()
2286 Self.Diag(SrcExpr.get()->getLocStart(), diag::err_opencl_cast_to_half) in CheckCStyleCast()
2294 if (Self.getLangOpts().ObjCAutoRefCount) { in CheckCStyleCast()
2306 Self.Diag(SrcExpr.get()->getLocStart(), in CheckCStyleCast()
2314 else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) { in CheckCStyleCast()
2315 Self.Diag(SrcExpr.get()->getLocStart(), in CheckCStyleCast()
2322 DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType); in CheckCStyleCast()
2323 DiagnoseBadFunctionCast(Self, SrcExpr, DestType); in CheckCStyleCast()
2324 Kind = Self.PrepareScalarCast(SrcExpr, DestType); in CheckCStyleCast()