diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-02-22 01:22:48 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-02-22 01:22:48 +0000 |
commit | f0b1a0ee4787cd60a34951950baa6dd7d3d53a64 (patch) | |
tree | 77176035a3b01cbe9e21833071af5df73da09a61 /lib/Sema/SemaExprObjC.cpp | |
parent | 87193dac8f2c6c8f7ee1aa9eeb64622ec75c881b (diff) |
objective-C arc: Diagnostic can not say to use bridge
casts with c++ named casts. Change notes to say use
bridge with c-style cast instead. // rdar://12788838
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index c0df31868a..2dbba853e4 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -2925,15 +2925,22 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange, assert(CreateRule != ACC_bottom && "This cast should already be accepted."); if (CreateRule != ACC_plusOne) { - DiagnosticBuilder DiagB = S.Diag(noteLoc, diag::note_arc_bridge); + DiagnosticBuilder DiagB = + (CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge) + : S.Diag(noteLoc, diag::note_arc_cstyle_bridge); + addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen, castType, castExpr, "__bridge ", 0); } if (CreateRule != ACC_plusZero) { - DiagnosticBuilder DiagB = S.Diag(br ? castExpr->getExprLoc() : noteLoc, - diag::note_arc_bridge_transfer) - << castExprType << br; + DiagnosticBuilder DiagB = + (CCK == Sema::CCK_OtherCast && !br) ? + S.Diag(noteLoc, diag::note_arc_cstyle_bridge_transfer) << castExprType : + S.Diag(br ? castExpr->getExprLoc() : noteLoc, + diag::note_arc_bridge_transfer) + << castExprType << br; + addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen, castType, castExpr, "__bridge_transfer ", br ? "CFBridgingRelease" : 0); @@ -2958,15 +2965,21 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange, assert(CreateRule != ACC_bottom && "This cast should already be accepted."); if (CreateRule != ACC_plusOne) { - DiagnosticBuilder DiagB = S.Diag(noteLoc, diag::note_arc_bridge); + DiagnosticBuilder DiagB = + (CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge) + : S.Diag(noteLoc, diag::note_arc_cstyle_bridge); addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen, castType, castExpr, "__bridge ", 0); } if (CreateRule != ACC_plusZero) { - DiagnosticBuilder DiagB = S.Diag(br ? castExpr->getExprLoc() : noteLoc, - diag::note_arc_bridge_retained) - << castType << br; + DiagnosticBuilder DiagB = + (CCK == Sema::CCK_OtherCast && !br) ? + S.Diag(noteLoc, diag::note_arc_cstyle_bridge_retained) << castType : + S.Diag(br ? castExpr->getExprLoc() : noteLoc, + diag::note_arc_bridge_retained) + << castType << br; + addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen, castType, castExpr, "__bridge_retained ", br ? "CFBridgingRetain" : 0); |