diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 9 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 16 |
3 files changed, 16 insertions, 11 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index 0721814c18..50e39e0d04 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -1774,15 +1774,8 @@ Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, ExprValueKind &VK, } } - if (getLangOptions().ObjCAutoRefCount && tcr == TC_Success) { + if (getLangOptions().ObjCAutoRefCount && tcr == TC_Success) CheckObjCARCConversion(R, CastTy, CastExpr, CCK); - if (!CheckObjCARCUnavailableWeakConversion(CastTy, - origCastExprType)) - Diag(CastExpr->getLocStart(), - diag::err_arc_cast_of_weak_unavailable) - << origCastExprType << CastTy - << CastExpr->getSourceRange(); - } if (tcr != TC_Success && msg != 0) { if (CastExpr->getType() == Context.OverloadTy) { diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index fea31aa046..09c68aef69 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -4068,7 +4068,7 @@ ExprResult Sema::CheckCastTypes(SourceLocation CastStartLoc, SourceRange TyR, } else if (!CheckObjCARCUnavailableWeakConversion(castType, castExprType)) { Diag(castExpr->getLocStart(), - diag::err_arc_cast_of_weak_unavailable) + diag::err_arc_convesion_of_weak_unavailable) << 1 << castExprType << castType << castExpr->getSourceRange(); return ExprError(); diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 4c096fe0ec..7ee9c1bec2 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -2340,8 +2340,20 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, if (From->getType()->isObjCObjectPointerType() && ToType->isObjCObjectPointerType()) EmitRelatedResultTypeNote(From); - } - + } + else if (getLangOptions().ObjCAutoRefCount && + !CheckObjCARCUnavailableWeakConversion(ToType, + From->getType())) { + if (Action == AA_Initializing) + Diag(From->getSourceRange().getBegin(), + diag::err_arc_weak_unavailable_assign); + else + Diag(From->getSourceRange().getBegin(), + diag::err_arc_convesion_of_weak_unavailable) + << (Action == AA_Casting) << From->getType() << ToType + << From->getSourceRange(); + } + CastKind Kind = CK_Invalid; CXXCastPath BasePath; if (CheckPointerConversion(From, ToType, Kind, BasePath, CStyle)) |