From 9853045b50a39fda3783f06f6bcef612fe6e7183 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 12 Aug 2008 20:41:56 +0000 Subject: [PATCH] More cleanups. Add missing #include. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54699 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/CFRefCount.cpp | 39 +++++++------------------------------ 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index a5a5b88832..f36b4eb1fc 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -29,6 +29,7 @@ #include "llvm/ADT/STLExtras.h" #include #include +#include using namespace clang; using llvm::CStrInCStrNoCase; @@ -375,7 +376,7 @@ public: return I; } - + iterator find(Expr* Receiver, Selector S) { return find(getReceiverDecl(Receiver), S); } @@ -450,13 +451,7 @@ class VISIBILITY_HIDDEN RetainSummaryManager { /// Ctx - The ASTContext object for the analyzed ASTs. ASTContext& Ctx; - - /// NSWindowII - An IdentifierInfo* representing the identifier "NSWindow." - IdentifierInfo* NSWindowII; - /// NSPanelII - An IdentifierInfo* representing the identifier "NSPanel." - IdentifierInfo* NSPanelII; - /// CFDictionaryCreateII - An IdentifierInfo* representing the indentifier /// "CFDictionaryCreate". IdentifierInfo* CFDictionaryCreateII; @@ -513,14 +508,12 @@ class VISIBILITY_HIDDEN RetainSummaryManager { ArgEffect DefaultEff = MayEscape, bool isEndPath = false); - RetainSummary* getPersistentSummary(RetEffect RE, ArgEffect ReceiverEff = DoNothing, ArgEffect DefaultEff = MayEscape) { return getPersistentSummary(getArgEffects(), RE, ReceiverEff, DefaultEff); } - RetainSummary* getPersistentStopSummary() { if (StopSummary) return StopSummary; @@ -549,14 +542,6 @@ class VISIBILITY_HIDDEN RetainSummaryManager { ObjCMethodSummaries[S] = Summ; } - void addNSWindowMethSummary(Selector S, RetainSummary *Summ) { - ObjCMethodSummaries[ObjCSummaryKey(NSWindowII, S)] = Summ; - } - - void addNSPanelMethSummary(Selector S, RetainSummary *Summ) { - ObjCMethodSummaries[ObjCSummaryKey(NSPanelII, S)] = Summ; - } - void addInstMethSummary(const char* Cls, RetainSummary* Summ, va_list argp) { IdentifierInfo* ClsII = &Ctx.Idents.get(Cls); @@ -589,8 +574,6 @@ public: RetainSummaryManager(ASTContext& ctx, bool gcenabled) : Ctx(ctx), - NSWindowII(&ctx.Idents.get("NSWindow")), - NSPanelII(&ctx.Idents.get("NSPanel")), CFDictionaryCreateII(&ctx.Idents.get("CFDictionaryCreate")), GCEnabled(gcenabled), StopSummary(0) { @@ -841,6 +824,7 @@ RetainSummaryManager::getUnarySummary(FunctionDecl* FD, UnaryFuncKind func) { default: assert (false && "Not a supported unary function."); + return 0; } } @@ -999,11 +983,11 @@ void RetainSummaryManager::InitializeMethodSummaries() { RetainSummary* Summ = getPersistentSummary(E); // Create the "copy" selector. - addNSObjectMethSummary(GetNullarySelector("copy", Ctx), Summ); - + addNSObjectMethSummary(GetNullarySelector("copy", Ctx), Summ); + // Create the "mutableCopy" selector. addNSObjectMethSummary(GetNullarySelector("mutableCopy", Ctx), Summ); - + // Create the "retain" selector. E = RetEffect::MakeReceiverAlias(); Summ = getPersistentSummary(E, isGCEnabled() ? DoNothing : IncRef); @@ -1020,7 +1004,7 @@ void RetainSummaryManager::InitializeMethodSummaries() { // Create the "autorelease" selector. Summ = getPersistentSummary(E, isGCEnabled() ? DoNothing : Autorelease); addNSObjectMethSummary(GetNullarySelector("autorelease", Ctx), Summ); - + // For NSWindow, allocated objects are (initially) self-owned. RetainSummary *NSWindowSumm = getPersistentSummary(RetEffect::MakeReceiverAlias(), SelfOwn); @@ -1128,15 +1112,6 @@ public: return RefVal(ReturnedNotOwned); } - // State creation: errors. - -#if 0 - static RefVal makeLeak(unsigned Count) { return RefVal(ErrorLeak, Count); } - static RefVal makeReleased() { return RefVal(Released); } - static RefVal makeUseAfterRelease() { return RefVal(ErrorUseAfterRelease); } - static RefVal makeReleaseNotOwned() { return RefVal(ErrorReleaseNotOwned); } -#endif - // Comparison, profiling, and pretty-printing. bool operator==(const RefVal& X) const {