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 | ac2d082f58e61aa9424cbe778677f61109cf7392 (patch) | |
tree | 79c0f6beb47a81ae0fb80b868bb7cfe492073569 /clang/lib | |
parent | 57ecf603c48436ae99d4d346b5b89e078f84fdd4 (diff) | |
download | bcm5719-llvm-ac2d082f58e61aa9424cbe778677f61109cf7392.tar.gz bcm5719-llvm-ac2d082f58e61aa9424cbe778677f61109cf7392.zip |
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
llvm-svn: 175850
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index c0df31868aa..2dbba853e40 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/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); |