Lines Matching defs:Self
49 : Self(S), SrcExpr(src), DestType(destType),
62 Sema &Self;
89 castExpr = ImplicitCastExpr::Create(Self.Context,
90 Self.Context.ARCUnbridgedCastTy,
94 return Self.Owned(castExpr);
117 Self.CheckCastAlign(SrcExpr.get(), DestType, OpRange);
121 assert(Self.getLangOpts().ObjCAutoRefCount);
124 if (Self.CheckObjCARCConversion(OpRange, DestType, src, CCK) ==
135 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take());
143 static bool CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
157 static TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr,
162 static TryCastResult TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr,
168 static TryCastResult TryStaticPointerDowncast(Sema &Self, QualType SrcType,
174 static TryCastResult TryStaticDowncast(Sema &Self, CanQualType SrcType,
181 static TryCastResult TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr,
189 static TryCastResult TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr,
195 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
202 static TryCastResult TryConstCast(Sema &Self, Expr *SrcExpr, QualType DestType,
204 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
460 CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
465 !Self.Context.getLangOpts().ObjCAutoRefCount)
479 QualType UnwrappedSrcType = Self.Context.getCanonicalType(SrcType),
480 UnwrappedDestType = Self.Context.getCanonicalType(DestType);
489 Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals);
490 Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals);
510 QualType SrcConstruct = Self.Context.VoidTy;
511 QualType DestConstruct = Self.Context.VoidTy;
512 ASTContext &Context = Self.Context;
525 !Self.IsQualificationConversion(SrcConstruct, DestConstruct, false,
534 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
536 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take());
541 QualType DestType = Self.Context.getCanonicalType(this->DestType);
554 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ref_or_ptr)
563 if (Self.RequireCompleteType(OpRange.getBegin(), DestPointee,
564 Self.PDiag(diag::err_bad_dynamic_cast_incomplete)
568 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class)
577 QualType SrcType = Self.Context.getCanonicalType(OrigSrcType);
583 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ptr)
589 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
599 if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee,
600 Self.PDiag(diag::err_bad_dynamic_cast_incomplete)
604 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class)
617 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_qualifiers_away)
631 if (DestRecord && Self.IsDerivedFrom(SrcPointee, DestPointee)) {
632 if (Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee,
641 if (Self.BasePathInvolvesVirtualBase(BasePath))
642 Self.MarkVTableUsed(OpRange.getBegin(),
651 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic)
654 Self.MarkVTableUsed(OpRange.getBegin(),
668 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
670 SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take());
675 if (TryConstCast(Self, SrcExpr.get(), DestType, /*CStyle*/false, msg) != TC_Success
677 Self.Diag(OpRange.getBegin(), msg) << CT_Const
688 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
696 TryReinterpretCast(Self, SrcExpr, DestType,
702 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) {
704 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_overload)
707 Self.NoteAllOverloadCandidates(SrcExpr.get());
710 diagnoseBadCast(Self, msg, CT_Reinterpret, OpRange, SrcExpr.get(),
713 } else if (tcr == TC_Success && Self.getLangOpts().ObjCAutoRefCount) {
736 Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr,
744 SrcExpr = Self.IgnoredValueConversions(SrcExpr.take());
750 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
757 = TryStaticCast(Self, SrcExpr, DestType, Sema::CCK_OtherCast, OpRange, msg,
762 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) {
764 Self.Diag(OpRange.getBegin(), diag::err_bad_static_cast_overload)
767 Self.NoteAllOverloadCandidates(SrcExpr.get());
769 diagnoseBadCast(Self, msg, CT_Static, OpRange, SrcExpr.get(), DestType,
775 if (Self.getLangOpts().ObjCAutoRefCount)
785 static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
815 tcr = TryStaticReferenceDowncast(Self, SrcExpr.get(), DestType, CStyle,
823 tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind,
830 tcr = TryStaticImplicitCast(Self, SrcExpr, DestType, CCK, OpRange, msg,
845 QualType SrcType = Self.Context.getCanonicalType(SrcExpr.get()->getType());
855 } else if (DestType->isIntegralType(Self.Context)) {
885 tcr = TryStaticPointerDowncast(Self, SrcType, DestType, CStyle, OpRange, msg,
893 tcr = TryStaticMemberPointerUpcast(Self, SrcExpr, SrcType, DestType, CStyle,
953 TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType,
979 if (Self.CompareReferenceRelationship(SrcExpr->getLocStart(),
992 if (!Self.IsDerivedFrom(SrcExpr->getType(), R->getPointeeType(), Paths))
995 Self.BuildBasePathArray(Paths, BasePath);
1004 TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType,
1030 return TryStaticDowncast(Self,
1031 Self.Context.getCanonicalType(SrcExpr->getType()),
1032 Self.Context.getCanonicalType(DestPointee), CStyle,
1039 TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType,
1062 return TryStaticDowncast(Self,
1063 Self.Context.getCanonicalType(SrcPointer->getPointeeType()),
1064 Self.Context.getCanonicalType(DestPointer->getPointeeType()),
1073 TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType,
1078 if (Self.RequireCompleteType(OpRange.getBegin(), SrcType, Self.PDiag(0)) ||
1079 Self.RequireCompleteType(OpRange.getBegin(), DestType, Self.PDiag(0)))
1089 if (!Self.IsDerivedFrom(DestType, SrcType, Paths)) {
1125 Self.IsDerivedFrom(DestType, SrcType, Paths);
1143 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_base_to_derived_cast)
1153 Self.Diag(OpRange.getBegin(), diag::err_static_downcast_via_virtual)
1160 switch (Self.CheckBaseClassAccess(OpRange.getBegin(),
1175 Self.BuildBasePathArray(Paths, BasePath);
1188 TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType,
1199 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) {
1201 = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(), DestType, false,
1204 SrcType = Self.Context.getMemberPointerType(Fn->getType(),
1205 Self.Context.getTypeDeclType(M->getParent()).getTypePtr());
1217 if (!Self.Context.hasSameUnqualifiedType(SrcMemPtr->getPointeeType(),
1226 if (!Self.IsDerivedFrom(SrcClass, DestClass, Paths)) {
1231 if (Paths.isAmbiguous(Self.Context.getCanonicalType(DestClass))) {
1234 bool StillOkay = Self.IsDerivedFrom(SrcClass, DestClass, Paths);
1237 std::string PathDisplayStr = Self.getAmbiguousPathsDisplayString(Paths);
1238 Self.Diag(OpRange.getBegin(), diag::err_ambiguous_memptr_conv)
1245 Self.Diag(OpRange.getBegin(), diag::err_memptr_conv_via_virtual)
1252 switch (Self.CheckBaseClassAccess(OpRange.getBegin(),
1272 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(),
1281 SrcExpr = Self.FixOverloadedFunctionReference(SrcExpr, FoundOverload, Fn);
1288 Self.BuildBasePathArray(Paths, BasePath);
1299 TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType,
1304 if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
1320 InitializationSequence InitSeq(Self, Entity, InitKind, &SrcExprRaw, 1);
1333 = InitSeq.Perform(Self, Entity, InitKind, MultiExprArg(Self, &SrcExprRaw, 1));
1350 static TryCastResult TryConstCast(Sema &Self, Expr *SrcExpr, QualType DestType,
1352 DestType = Self.Context.getCanonicalType(DestType);
1365 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
1366 SrcType = Self.Context.getPointerType(SrcType);
1393 SrcType = Self.Context.getCanonicalType(SrcType);
1401 Self.Context.UnwrapSimilarPointerTypes(SrcType, DestType)) {
1403 SrcType = Self.Context.getUnqualifiedArrayType(SrcType, SrcQuals);
1404 DestType = Self.Context.getUnqualifiedArrayType(DestType, DestQuals);
1478 static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
1485 DestType = Self.Context.getCanonicalType(DestType);
1490 if (SrcType == Self.Context.OverloadTy) {
1495 if (Self.ResolveAndFixSingleFunctionTemplateSpecialization(
1516 Self.CheckCompatibleReinterpretCast(SrcType, DestType,
1535 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_reference)
1543 DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
1544 SrcType = Self.Context.getPointerType(SrcType);
1550 SrcType = Self.Context.getCanonicalType(SrcType);
1567 if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle,
1574 if (Self.Context.getTypeSize(DestMemPtr) !=
1575 Self.Context.getTypeSize(SrcMemPtr)) {
1587 if (SrcType->isNullPtrType() && DestType->isIntegralType(Self.Context)) {
1592 if (Self.Context.getTypeSize(SrcType) >
1593 Self.Context.getTypeSize(DestType)) {
1605 bool srcIsScalar = SrcType->isIntegralType(Self.Context);
1606 bool destIsScalar = DestType->isIntegralType(Self.Context);
1614 if (Self.Context.getTypeSize(SrcType)
1615 == Self.Context.getTypeSize(DestType)) {
1660 if (DestType->isIntegralType(Self.Context)) {
1665 if ((Self.Context.getTypeSize(SrcType) >
1666 Self.Context.getTypeSize(DestType)) &&
1667 !Self.getLangOpts().MicrosoftExt) {
1693 if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle,
1707 Kind = Self.PrepareCastToObjCObjectPointer(SrcExpr);
1740 Self.Diag(OpRange.getBegin(),
1741 Self.getLangOpts().CPlusPlus0x ?
1749 Self.Diag(OpRange.getBegin(),
1750 Self.getLangOpts().CPlusPlus0x ?
1770 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType,
1788 Self.ResolveAndFixSingleFunctionTemplateSpecialization(
1796 SrcExpr = Self.IgnoredValueConversions(SrcExpr.take());
1811 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
1837 TryCastResult tcr = TryConstCast(Self, SrcExpr.get(), DestType,
1847 tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange,
1854 tcr = TryReinterpretCast(Self, SrcExpr, DestType, /*CStyle*/true,
1861 if (Self.getLangOpts().ObjCAutoRefCount && tcr == TC_Success)
1865 if (SrcExpr.get()->getType() == Self.Context.OverloadTy) {
1867 FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(),
1876 diagnoseBadCast(Self, msg, (FunctionalStyle ? CT_Functional : CT_CStyle),
1890 assert(!Self.getLangOpts().CPlusPlus);
1894 SrcExpr = Self.checkUnknownAnyCast(DestRange, DestType,
1904 SrcExpr = Self.IgnoredValueConversions(SrcExpr.take());
1913 SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
1924 if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
1933 if (DestRecordTy && Self.Context.hasSameUnqualifiedType(DestType, SrcType)){
1934 // GCC struct/union extension: allow cast to self.
1935 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_nonscalar)
1947 if (Self.Context.hasSameUnqualifiedType(Field->getType(), SrcType) &&
1949 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union)
1955 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cast_to_union_no_type)
1965 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cond_expect_scalar)
1975 Self.Diag(SrcExpr.get()->getExprLoc(),
1983 SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.take(), Kind);
1991 } else if (Self.CheckVectorCast(OpRange, DestType, SrcType, Kind)) {
1998 if (Self.CheckVectorCast(OpRange, SrcType, DestType, Kind))
2009 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_selector_expr);
2017 if (!SrcType->isIntegralType(Self.Context) && SrcType->isArithmeticType()) {
2018 Self.Diag(SrcExpr.get()->getExprLoc(),
2025 if (!DestType->isIntegralType(Self.Context) &&
2027 Self.Diag(SrcExpr.get()->getLocStart(),
2036 if (Self.getLangOpts().ObjCAutoRefCount) {
2048 Self.Diag(SrcExpr.get()->getLocStart(),
2056 else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) {
2057 Self.Diag(SrcExpr.get()->getLocStart(),
2065 Kind = Self.PrepareScalarCast(SrcExpr, DestType);