Lines Matching defs:Self

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