[analyzer] Remove an unused enum value in RetainCountChecker.

No functional change intended.

Differential Revision: https://reviews.llvm.org/D27408

llvm-svn: 288917
This commit is contained in:
Artem Dergachev 2016-12-07 16:51:54 +00:00
parent 967325b373
commit 5b6ff3f43a
2 changed files with 11 additions and 16 deletions

View File

@ -120,9 +120,6 @@ public:
NoRet, NoRet,
/// Indicates that the returned value is an owned (+1) symbol. /// Indicates that the returned value is an owned (+1) symbol.
OwnedSymbol, OwnedSymbol,
/// Indicates that the returned value is an owned (+1) symbol and
/// that it should be treated as freshly allocated.
OwnedAllocatedSymbol,
/// Indicates that the returned value is an object with retain count /// Indicates that the returned value is an object with retain count
/// semantics but that it is not owned (+0). This is the default /// semantics but that it is not owned (+0). This is the default
/// for getters, etc. /// for getters, etc.
@ -163,8 +160,7 @@ public:
ObjKind getObjKind() const { return O; } ObjKind getObjKind() const { return O; }
bool isOwned() const { bool isOwned() const {
return K == OwnedSymbol || K == OwnedAllocatedSymbol || return K == OwnedSymbol || K == OwnedWhenTrackedReceiver;
K == OwnedWhenTrackedReceiver;
} }
bool notOwned() const { bool notOwned() const {
@ -179,8 +175,8 @@ public:
return RetEffect(OwnedWhenTrackedReceiver, ObjC); return RetEffect(OwnedWhenTrackedReceiver, ObjC);
} }
static RetEffect MakeOwned(ObjKind o, bool isAllocated = false) { static RetEffect MakeOwned(ObjKind o) {
return RetEffect(isAllocated ? OwnedAllocatedSymbol : OwnedSymbol, o); return RetEffect(OwnedSymbol, o);
} }
static RetEffect MakeNotOwned(ObjKind o) { static RetEffect MakeNotOwned(ObjKind o) {
return RetEffect(NotOwnedSymbol, o); return RetEffect(NotOwnedSymbol, o);

View File

@ -740,7 +740,7 @@ public:
ObjCAllocRetE(gcenabled ObjCAllocRetE(gcenabled
? RetEffect::MakeGCNotOwned() ? RetEffect::MakeGCNotOwned()
: (usesARC ? RetEffect::MakeNotOwned(RetEffect::ObjC) : (usesARC ? RetEffect::MakeNotOwned(RetEffect::ObjC)
: RetEffect::MakeOwned(RetEffect::ObjC, true))), : RetEffect::MakeOwned(RetEffect::ObjC))),
ObjCInitRetE(gcenabled ObjCInitRetE(gcenabled
? RetEffect::MakeGCNotOwned() ? RetEffect::MakeGCNotOwned()
: (usesARC ? RetEffect::MakeNotOwned(RetEffect::ObjC) : (usesARC ? RetEffect::MakeNotOwned(RetEffect::ObjC)
@ -1086,7 +1086,7 @@ RetainSummaryManager::getFunctionSummary(const FunctionDecl *FD) {
FName == "IOOpenFirmwarePathMatching") { FName == "IOOpenFirmwarePathMatching") {
// Part of <rdar://problem/6961230>. (IOKit) // Part of <rdar://problem/6961230>. (IOKit)
// This should be addressed using a API table. // This should be addressed using a API table.
S = getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true), S = getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF),
DoNothing, DoNothing); DoNothing, DoNothing);
} else if (FName == "IOServiceGetMatchingService" || } else if (FName == "IOServiceGetMatchingService" ||
FName == "IOServiceGetMatchingServices") { FName == "IOServiceGetMatchingServices") {
@ -1116,7 +1116,7 @@ RetainSummaryManager::getFunctionSummary(const FunctionDecl *FD) {
// passed to CGBitmapContextCreateWithData is released via // passed to CGBitmapContextCreateWithData is released via
// a callback and doing full IPA to make sure this is done correctly. // a callback and doing full IPA to make sure this is done correctly.
ScratchArgs = AF.add(ScratchArgs, 8, StopTracking); ScratchArgs = AF.add(ScratchArgs, 8, StopTracking);
S = getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true), S = getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF),
DoNothing, DoNothing); DoNothing, DoNothing);
} else if (FName == "CVPixelBufferCreateWithPlanarBytes") { } else if (FName == "CVPixelBufferCreateWithPlanarBytes") {
// FIXES: <rdar://problem/7283567> // FIXES: <rdar://problem/7283567>
@ -1292,7 +1292,7 @@ const RetainSummary *
RetainSummaryManager::getCFSummaryCreateRule(const FunctionDecl *FD) { RetainSummaryManager::getCFSummaryCreateRule(const FunctionDecl *FD) {
assert (ScratchArgs.isEmpty()); assert (ScratchArgs.isEmpty());
return getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true)); return getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF));
} }
const RetainSummary * const RetainSummary *
@ -1322,7 +1322,7 @@ RetainSummaryManager::getRetEffectFromAnnotations(QualType RetTy,
} }
if (D->hasAttr<CFReturnsRetainedAttr>()) if (D->hasAttr<CFReturnsRetainedAttr>())
return RetEffect::MakeOwned(RetEffect::CF, true); return RetEffect::MakeOwned(RetEffect::CF);
if (D->hasAttr<CFReturnsNotRetainedAttr>()) if (D->hasAttr<CFReturnsNotRetainedAttr>())
return RetEffect::MakeNotOwned(RetEffect::CF); return RetEffect::MakeNotOwned(RetEffect::CF);
@ -1435,7 +1435,7 @@ RetainSummaryManager::getStandardMethodSummary(const ObjCMethodDecl *MD,
case OMF_new: case OMF_new:
case OMF_copy: case OMF_copy:
case OMF_mutableCopy: case OMF_mutableCopy:
ResultEff = RetEffect::MakeOwned(RetEffect::CF, true); ResultEff = RetEffect::MakeOwned(RetEffect::CF);
break; break;
default: default:
ResultEff = RetEffect::MakeNotOwned(RetEffect::CF); ResultEff = RetEffect::MakeNotOwned(RetEffect::CF);
@ -1457,7 +1457,7 @@ RetainSummaryManager::getStandardMethodSummary(const ObjCMethodDecl *MD,
if (cocoa::isCocoaObjectRef(RetTy)) if (cocoa::isCocoaObjectRef(RetTy))
ResultEff = ObjCAllocRetE; ResultEff = ObjCAllocRetE;
else if (coreFoundation::isCFObjectRef(RetTy)) else if (coreFoundation::isCFObjectRef(RetTy))
ResultEff = RetEffect::MakeOwned(RetEffect::CF, true); ResultEff = RetEffect::MakeOwned(RetEffect::CF);
break; break;
case OMF_autorelease: case OMF_autorelease:
ReceiverEff = Autorelease; ReceiverEff = Autorelease;
@ -1588,7 +1588,7 @@ void RetainSummaryManager::InitializeMethodSummaries() {
// The next methods are allocators. // The next methods are allocators.
const RetainSummary *AllocSumm = getPersistentSummary(ObjCAllocRetE); const RetainSummary *AllocSumm = getPersistentSummary(ObjCAllocRetE);
const RetainSummary *CFAllocSumm = const RetainSummary *CFAllocSumm =
getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true)); getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF));
// Create the "retain" selector. // Create the "retain" selector.
RetEffect NoRet = RetEffect::MakeNoRet(); RetEffect NoRet = RetEffect::MakeNoRet();
@ -3076,7 +3076,6 @@ void RetainCountChecker::checkSummary(const RetainSummary &Summ,
// No work necessary. // No work necessary.
break; break;
case RetEffect::OwnedAllocatedSymbol:
case RetEffect::OwnedSymbol: { case RetEffect::OwnedSymbol: {
SymbolRef Sym = CallOrMsg.getReturnValue().getAsSymbol(); SymbolRef Sym = CallOrMsg.getReturnValue().getAsSymbol();
if (!Sym) if (!Sym)