summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-07-27 23:55:46 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-07-27 23:55:46 +0000
commitae5bbfc0d00c89d2d63f37dce89804c4160cf50c (patch)
tree379df830737bfcee7c13374acc11b692257f586b /clang/lib/Sema
parent99b537ef15e8d076d607212d948ea72b1de0482a (diff)
downloadbcm5719-llvm-ae5bbfc0d00c89d2d63f37dce89804c4160cf50c.tar.gz
bcm5719-llvm-ae5bbfc0d00c89d2d63f37dce89804c4160cf50c.zip
objc-arc: change per Jordy's comments.
// rdar://11923822 llvm-svn: 160902
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 09f12d7ee29..20c8e884be0 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -2670,21 +2670,22 @@ namespace {
// now we're not going to permit implicit handling of +1 results,
// because it's a bit frightening.
if (fn->hasAttr<CFReturnsRetainedAttr>())
- return ACC_invalid; // ACC_plusOne if we start accepting this
+ return Diagnose ? ACC_plusOne
+ : ACC_invalid; // ACC_plusOne if we start accepting this
// Recognize this specific builtin function, which is used by CFSTR.
unsigned builtinID = fn->getBuiltinID();
if (builtinID == Builtin::BI__builtin___CFStringMakeConstantString)
return ACC_bottom;
+ // Otherwise, don't do anything implicit with an unaudited function.
+ if (!fn->hasAttr<CFAuditedTransferAttr>())
+ return ACC_invalid;
+
// Otherwise, it's +0 unless it follows the create convention.
if (ento::coreFoundation::followsCreateRule(fn))
return Diagnose ? ACC_plusOne
: ACC_invalid; // ACC_plusOne if we start accepting this
-
- // Otherwise, don't do anything implicit with an unaudited function.
- if (!fn->hasAttr<CFAuditedTransferAttr>())
- return ACC_invalid;
return ACC_plusZero;
}
@@ -2859,15 +2860,15 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
<< castRange
<< castExpr->getSourceRange();
bool br = S.isKnownName("CFBridgingRelease");
- bool fCreateRule =
- ARCCastChecker(S.Context, exprACTC, castACTC, true).Visit(castExpr)
- == ACC_plusOne;
- if (!fCreateRule)
+ ACCResult CreateRule =
+ ARCCastChecker(S.Context, exprACTC, castACTC, true).Visit(castExpr);
+ if (CreateRule != ACC_plusOne)
{
DiagnosticBuilder DiagB = S.Diag(noteLoc, diag::note_arc_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)
@@ -2891,15 +2892,15 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
<< castType
<< castRange
<< castExpr->getSourceRange();
- bool fCreateRule =
- ARCCastChecker(S.Context, exprACTC, castACTC, true).Visit(castExpr)
- == ACC_plusOne;
- if (!fCreateRule)
+ ACCResult CreateRule =
+ ARCCastChecker(S.Context, exprACTC, castACTC, true).Visit(castExpr);
+ if (CreateRule != ACC_plusOne)
{
DiagnosticBuilder DiagB = S.Diag(noteLoc, diag::note_arc_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)
OpenPOWER on IntegriCloud