From: Ted Kremenek Date: Wed, 24 Nov 2010 00:54:37 +0000 (+0000) Subject: Adjust method calls to reflect name changes in X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3baf672378f105602d2b12f03f00277ae1936fe9;p=clang Adjust method calls to reflect name changes in ImmutableSet/ImmtuableMap/ImmutableList APIs. Along the way, clean up some method names in the static analyzer so that they are more descriptive and/or start with lowercase letters. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120071 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Checker/BugReporter/BugReporter.h b/include/clang/Checker/BugReporter/BugReporter.h index 263dac8480..89075c6537 100644 --- a/include/clang/Checker/BugReporter/BugReporter.h +++ b/include/clang/Checker/BugReporter/BugReporter.h @@ -282,11 +282,11 @@ private: void FlushReport(BugReportEquivClass& EQ); protected: - BugReporter(BugReporterData& d, Kind k) : BugTypes(F.GetEmptySet()), kind(k), + BugReporter(BugReporterData& d, Kind k) : BugTypes(F.getEmptySet()), kind(k), D(d) {} public: - BugReporter(BugReporterData& d) : BugTypes(F.GetEmptySet()), kind(BaseBRKind), + BugReporter(BugReporterData& d) : BugTypes(F.getEmptySet()), kind(BaseBRKind), D(d) {} virtual ~BugReporter(); @@ -399,7 +399,7 @@ class BugReporterContext { llvm::ImmutableList Callbacks; llvm::FoldingSet CallbacksSet; public: - BugReporterContext(GRBugReporter& br) : BR(br), Callbacks(F.GetEmptyList()) {} + BugReporterContext(GRBugReporter& br) : BR(br), Callbacks(F.getEmptyList()) {} virtual ~BugReporterContext(); void addVisitor(BugReporterVisitor* visitor); diff --git a/include/clang/Checker/PathSensitive/BasicValueFactory.h b/include/clang/Checker/PathSensitive/BasicValueFactory.h index 59dd9190d2..a64148aa07 100644 --- a/include/clang/Checker/PathSensitive/BasicValueFactory.h +++ b/include/clang/Checker/PathSensitive/BasicValueFactory.h @@ -172,11 +172,11 @@ public: const TypedRegion *region); llvm::ImmutableList getEmptySValList() { - return SValListFactory.GetEmptyList(); + return SValListFactory.getEmptyList(); } llvm::ImmutableList consVals(SVal X, llvm::ImmutableList L) { - return SValListFactory.Add(X, L); + return SValListFactory.add(X, L); } const llvm::APSInt* EvaluateAPSInt(BinaryOperator::Opcode Op, diff --git a/include/clang/Checker/PathSensitive/Environment.h b/include/clang/Checker/PathSensitive/Environment.h index 611f507945..3cb2611526 100644 --- a/include/clang/Checker/PathSensitive/Environment.h +++ b/include/clang/Checker/PathSensitive/Environment.h @@ -80,7 +80,7 @@ public: ~EnvironmentManager() {} Environment getInitialEnvironment() { - return Environment(F.GetEmptyMap()); + return Environment(F.getEmptyMap()); } /// Bind the value 'V' to the statement 'S'. diff --git a/include/clang/Checker/PathSensitive/GRStateTrait.h b/include/clang/Checker/PathSensitive/GRStateTrait.h index 5189a1f5aa..25be33f028 100644 --- a/include/clang/Checker/PathSensitive/GRStateTrait.h +++ b/include/clang/Checker/PathSensitive/GRStateTrait.h @@ -48,11 +48,11 @@ namespace clang { return B.lookup(K); } static data_type Set(data_type B, key_type K, value_type E,context_type F){ - return F.Add(B, K, E); + return F.add(B, K, E); } static data_type Remove(data_type B, key_type K, context_type F) { - return F.Remove(B, K); + return F.remove(B, K); } static inline context_type MakeContext(void* p) { @@ -86,11 +86,11 @@ namespace clang { } static data_type Add(data_type B, key_type K, context_type F) { - return F.Add(B, K); + return F.add(B, K); } static data_type Remove(data_type B, key_type K, context_type F) { - return F.Remove(B, K); + return F.remove(B, K); } static bool Contains(data_type B, key_type K) { @@ -119,7 +119,7 @@ namespace clang { typedef typename data_type::Factory& context_type; static data_type Add(data_type L, key_type K, context_type F) { - return F.Add(K, L); + return F.add(K, L); } static inline data_type MakeData(void* const* p) { diff --git a/lib/Checker/BasicConstraintManager.cpp b/lib/Checker/BasicConstraintManager.cpp index eee5c59466..b8da6b71af 100644 --- a/lib/Checker/BasicConstraintManager.cpp +++ b/lib/Checker/BasicConstraintManager.cpp @@ -237,10 +237,10 @@ const GRState* BasicConstraintManager::AddNE(const GRState* state, SymbolRef sym // First, retrieve the NE-set associated with the given symbol. ConstNotEqTy::data_type* T = state->get(sym); - GRState::IntSetTy S = T ? *T : ISetFactory.GetEmptySet(); + GRState::IntSetTy S = T ? *T : ISetFactory.getEmptySet(); // Now add V to the NE set. - S = ISetFactory.Add(S, &state->getBasicVals().getValue(V)); + S = ISetFactory.add(S, &state->getBasicVals().getValue(V)); // Create a new state with the old binding replaced. return state->set(sym, S); @@ -281,7 +281,8 @@ BasicConstraintManager::RemoveDeadBindings(const GRState* state, for (ConstEqTy::iterator I = CE.begin(), E = CE.end(); I!=E; ++I) { SymbolRef sym = I.getKey(); - if (SymReaper.maybeDead(sym)) CE = CEFactory.Remove(CE, sym); + if (SymReaper.maybeDead(sym)) + CE = CEFactory.remove(CE, sym); } state = state->set(CE); @@ -290,7 +291,8 @@ BasicConstraintManager::RemoveDeadBindings(const GRState* state, for (ConstNotEqTy::iterator I = CNE.begin(), E = CNE.end(); I != E; ++I) { SymbolRef sym = I.getKey(); - if (SymReaper.maybeDead(sym)) CNE = CNEFactory.Remove(CNE, sym); + if (SymReaper.maybeDead(sym)) + CNE = CNEFactory.remove(CNE, sym); } return state->set(CNE); diff --git a/lib/Checker/BasicStore.cpp b/lib/Checker/BasicStore.cpp index 3a5d20ca00..4fb0387ed5 100644 --- a/lib/Checker/BasicStore.cpp +++ b/lib/Checker/BasicStore.cpp @@ -218,7 +218,7 @@ Store BasicStoreManager::Bind(Store store, Loc loc, SVal V) { // that is used to derive other symbols. if (isa(R)) { BindingsTy B = GetBindings(store); - return VBFactory.Add(B, R, V).getRoot(); + return VBFactory.add(B, R, V).getRoot(); } // Special case: handle store of pointer values (Loc) to pointers via @@ -256,8 +256,8 @@ Store BasicStoreManager::Bind(Store store, Loc loc, SVal V) { BindingsTy B = GetBindings(store); return V.isUnknown() - ? VBFactory.Remove(B, R).getRoot() - : VBFactory.Add(B, R, V).getRoot(); + ? VBFactory.remove(B, R).getRoot() + : VBFactory.add(B, R, V).getRoot(); } Store BasicStoreManager::Remove(Store store, Loc loc) { @@ -269,7 +269,7 @@ Store BasicStoreManager::Remove(Store store, Loc loc) { isa(R))) return store; - return VBFactory.Remove(GetBindings(store), R).getRoot(); + return VBFactory.remove(GetBindings(store), R).getRoot(); } default: assert ("Remove for given Loc type not yet implemented."); @@ -394,7 +394,7 @@ Store BasicStoreManager::getInitialStore(const LocationContext *InitLoc) { // any VarDecl whose value originally comes from outside the function. typedef LiveVariables::AnalysisDataTy LVDataTy; LVDataTy& D = InitLoc->getLiveVariables()->getAnalysisData(); - Store St = VBFactory.GetEmptyMap().getRoot(); + Store St = VBFactory.getEmptyMap().getRoot(); for (LVDataTy::decl_iterator I=D.begin_decl(), E=D.end_decl(); I != E; ++I) { const NamedDecl* ND = I->first; diff --git a/lib/Checker/BugReporter.cpp b/lib/Checker/BugReporter.cpp index b300a05b89..3fc62f3fbd 100644 --- a/lib/Checker/BugReporter.cpp +++ b/lib/Checker/BugReporter.cpp @@ -51,7 +51,7 @@ void BugReporterContext::addVisitor(BugReporterVisitor* visitor) { } CallbacksSet.InsertNode(visitor, InsertPos); - Callbacks = F.Add(visitor, Callbacks); + Callbacks = F.add(visitor, Callbacks); } //===----------------------------------------------------------------------===// @@ -1333,7 +1333,7 @@ void BugReporter::FlushReports() { } // Remove all references to the BugType objects. - BugTypes = F.GetEmptySet(); + BugTypes = F.getEmptySet(); } //===----------------------------------------------------------------------===// @@ -1615,7 +1615,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, } void BugReporter::Register(BugType *BT) { - BugTypes = F.Add(BugTypes, BT); + BugTypes = F.add(BugTypes, BT); } void BugReporter::EmitReport(BugReport* R) { diff --git a/lib/Checker/CFRefCount.cpp b/lib/Checker/CFRefCount.cpp index 8d1f4ba053..80cbfc50ad 100644 --- a/lib/Checker/CFRefCount.cpp +++ b/lib/Checker/CFRefCount.cpp @@ -762,7 +762,7 @@ private: } void addPanicSummary(const char* Cls, ...) { - RetainSummary* Summ = getPersistentSummary(AF.GetEmptyMap(), + RetainSummary* Summ = getPersistentSummary(AF.getEmptyMap(), RetEffect::MakeNoRet(), DoNothing, DoNothing, true); va_list argp; @@ -776,12 +776,12 @@ public: RetainSummaryManager(ASTContext& ctx, bool gcenabled) : Ctx(ctx), CFDictionaryCreateII(&ctx.Idents.get("CFDictionaryCreate")), - GCEnabled(gcenabled), AF(BPAlloc), ScratchArgs(AF.GetEmptyMap()), + GCEnabled(gcenabled), AF(BPAlloc), ScratchArgs(AF.getEmptyMap()), ObjCAllocRetE(gcenabled ? RetEffect::MakeGCNotOwned() : RetEffect::MakeOwned(RetEffect::ObjC, true)), ObjCInitRetE(gcenabled ? RetEffect::MakeGCNotOwned() : RetEffect::MakeOwnedWhenTrackedReceiver()), - DefaultSummary(AF.GetEmptyMap() /* per-argument effects (none) */, + DefaultSummary(AF.getEmptyMap() /* per-argument effects (none) */, RetEffect::MakeNoRet() /* return effect */, MayEscape, /* default argument effect */ DoNothing /* receiver effect */), @@ -881,7 +881,7 @@ RetainSummaryManager::~RetainSummaryManager() {} ArgEffects RetainSummaryManager::getArgEffects() { ArgEffects AE = ScratchArgs; - ScratchArgs = AF.GetEmptyMap(); + ScratchArgs = AF.getEmptyMap(); return AE; } @@ -967,13 +967,13 @@ RetainSummary* RetainSummaryManager::getSummary(const FunctionDecl* FD) { // FIXES: // This should be addressed using a API table. This strcmp is also // a little gross, but there is no need to super optimize here. - ScratchArgs = AF.Add(ScratchArgs, 1, DecRef); + ScratchArgs = AF.add(ScratchArgs, 1, DecRef); S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); } else if (FName == "IOServiceAddNotification" || FName == "IOServiceAddMatchingNotification") { // Part of . (IOKit) // This should be addressed using a API table. - ScratchArgs = AF.Add(ScratchArgs, 2, DecRef); + ScratchArgs = AF.add(ScratchArgs, 2, DecRef); S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); } else if (FName == "CVPixelBufferCreateWithBytes") { // FIXES: @@ -982,14 +982,14 @@ RetainSummary* RetainSummaryManager::getSummary(const FunctionDecl* FD) { // a callback and doing full IPA to make sure this is done correctly. // FIXME: This function has an out parameter that returns an // allocated object. - ScratchArgs = AF.Add(ScratchArgs, 7, StopTracking); + ScratchArgs = AF.add(ScratchArgs, 7, StopTracking); S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); } else if (FName == "CGBitmapContextCreateWithData") { // FIXES: // Eventually this can be improved by recognizing that 'releaseInfo' // passed to CGBitmapContextCreateWithData is released via // 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), DoNothing, DoNothing); } else if (FName == "CVPixelBufferCreateWithPlanarBytes") { @@ -998,7 +998,7 @@ RetainSummary* RetainSummaryManager::getSummary(const FunctionDecl* FD) { // buffer passed to CVPixelBufferCreateWithPlanarBytes is released // via a callback and doing full IPA to make sure this is done // correctly. - ScratchArgs = AF.Add(ScratchArgs, 12, StopTracking); + ScratchArgs = AF.add(ScratchArgs, 12, StopTracking); S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); } @@ -1129,19 +1129,19 @@ RetainSummaryManager::getUnarySummary(const FunctionType* FT, switch (func) { case cfretain: { - ScratchArgs = AF.Add(ScratchArgs, 0, IncRef); + ScratchArgs = AF.add(ScratchArgs, 0, IncRef); return getPersistentSummary(RetEffect::MakeAlias(0), DoNothing, DoNothing); } case cfrelease: { - ScratchArgs = AF.Add(ScratchArgs, 0, DecRef); + ScratchArgs = AF.add(ScratchArgs, 0, DecRef); return getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); } case cfmakecollectable: { - ScratchArgs = AF.Add(ScratchArgs, 0, MakeCollectable); + ScratchArgs = AF.add(ScratchArgs, 0, MakeCollectable); return getPersistentSummary(RetEffect::MakeAlias(0),DoNothing, DoNothing); } @@ -1156,8 +1156,8 @@ RetainSummaryManager::getCFSummaryCreateRule(const FunctionDecl* FD) { assert (ScratchArgs.isEmpty()); if (FD->getIdentifier() == CFDictionaryCreateII) { - ScratchArgs = AF.Add(ScratchArgs, 1, DoNothingByRef); - ScratchArgs = AF.Add(ScratchArgs, 2, DoNothingByRef); + ScratchArgs = AF.add(ScratchArgs, 1, DoNothingByRef); + ScratchArgs = AF.add(ScratchArgs, 2, DoNothingByRef); } return getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true)); @@ -1263,7 +1263,7 @@ RetainSummaryManager::getCommonMethodSummary(const ObjCMethodDecl* MD, if (ParmVarDecl *PD = *I) { QualType Ty = Ctx.getCanonicalType(PD->getType()); if (Ty.getLocalUnqualifiedType() == Ctx.VoidPtrTy) - ScratchArgs = AF.Add(ScratchArgs, i, StopTracking); + ScratchArgs = AF.add(ScratchArgs, i, StopTracking); } } @@ -1432,7 +1432,7 @@ void RetainSummaryManager::InitializeClassMethodSummaries() { getPersistentSummary(RetEffect::MakeNotOwned(RetEffect::ObjC))); // Create the [NSAutoreleasePool addObject:] summary. - ScratchArgs = AF.Add(ScratchArgs, 0, Autorelease); + ScratchArgs = AF.add(ScratchArgs, 0, Autorelease); addClassMethSummary("NSAutoreleasePool", "addObject", getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, Autorelease)); @@ -1627,10 +1627,10 @@ static const GRState * SendAutorelease(const GRState *state, if (cnts) { const unsigned *cnt = (*cnts).lookup(sym); - newCnts = F.Add(*cnts, sym, cnt ? *cnt + 1 : 1); + newCnts = F.add(*cnts, sym, cnt ? *cnt + 1 : 1); } else - newCnts = F.Add(F.GetEmptyMap(), sym, 1); + newCnts = F.add(F.getEmptyMap(), sym, 1); return state->set(pool, newCnts); } @@ -3016,7 +3016,7 @@ const GRState* CFRefCount::EvalAssume(const GRState *state, // If this is the case, stop tracking the symbol. if (state->getSymVal(I.getKey())) { changed = true; - B = RefBFactory.Remove(B, I.getKey()); + B = RefBFactory.remove(B, I.getKey()); } } @@ -3345,7 +3345,7 @@ void CFRefCount::EvalDeadSymbols(ExplodedNodeSet& Dst, RefBindings::Factory& F = state->get_context(); for (SymbolReaper::dead_iterator I = SymReaper.dead_begin(), - E = SymReaper.dead_end(); I!=E; ++I) B = F.Remove(B, *I); + E = SymReaper.dead_end(); I!=E; ++I) B = F.remove(B, *I); state = state->set(B); Builder.MakeNode(Dst, S, Pred, state); diff --git a/lib/Checker/CStringChecker.cpp b/lib/Checker/CStringChecker.cpp index 966d04f6e1..7374e8baa4 100644 --- a/lib/Checker/CStringChecker.cpp +++ b/lib/Checker/CStringChecker.cpp @@ -1004,7 +1004,7 @@ const GRState *CStringChecker::EvalRegionChanges(const GRState *state, // Is this entry for a super-region of a changed region? if (SuperRegions.count(MR)) { - Entries = F.Remove(Entries, MR); + Entries = F.remove(Entries, MR); continue; } @@ -1013,7 +1013,7 @@ const GRState *CStringChecker::EvalRegionChanges(const GRState *state, while (const SubRegion *SR = dyn_cast(Super)) { Super = SR->getSuperRegion(); if (Invalidated.count(Super)) { - Entries = F.Remove(Entries, MR); + Entries = F.remove(Entries, MR); break; } } @@ -1049,7 +1049,7 @@ void CStringChecker::EvalDeadSymbols(CheckerContext &C, SymbolReaper &SR) { SVal Len = I.getData(); if (SymbolRef Sym = Len.getAsSymbol()) { if (SR.isDead(Sym)) - Entries = F.Remove(Entries, I.getKey()); + Entries = F.remove(Entries, I.getKey()); } } diff --git a/lib/Checker/Environment.cpp b/lib/Checker/Environment.cpp index 10644ccc14..914070e030 100644 --- a/lib/Checker/Environment.cpp +++ b/lib/Checker/Environment.cpp @@ -86,12 +86,12 @@ Environment EnvironmentManager::bindExpr(Environment Env, const Stmt *S, if (V.isUnknown()) { if (Invalidate) - return Environment(F.Remove(Env.ExprBindings, S)); + return Environment(F.remove(Env.ExprBindings, S)); else return Env; } - return Environment(F.Add(Env.ExprBindings, S, V)); + return Environment(F.add(Env.ExprBindings, S, V)); } static inline const Stmt *MakeLocation(const Stmt *S) { @@ -101,7 +101,7 @@ static inline const Stmt *MakeLocation(const Stmt *S) { Environment EnvironmentManager::bindExprAndLocation(Environment Env, const Stmt *S, SVal location, SVal V) { - return Environment(F.Add(F.Add(Env.ExprBindings, MakeLocation(S), location), + return Environment(F.add(F.add(Env.ExprBindings, MakeLocation(S), location), S, V)); } @@ -175,7 +175,7 @@ EnvironmentManager::RemoveDeadBindings(Environment Env, // Block-level expressions in callers are assumed always live. if (isBlockExprInCallers(BlkExpr, SymReaper.getLocationContext())) { - NewEnv.ExprBindings = F.Add(NewEnv.ExprBindings, BlkExpr, X); + NewEnv.ExprBindings = F.add(NewEnv.ExprBindings, BlkExpr, X); if (isa(X)) { const MemRegion* R = cast(X).getRegion(); @@ -194,7 +194,7 @@ EnvironmentManager::RemoveDeadBindings(Environment Env, if (SymReaper.isLive(BlkExpr)) { // Copy the binding to the new map. - NewEnv.ExprBindings = F.Add(NewEnv.ExprBindings, BlkExpr, X); + NewEnv.ExprBindings = F.add(NewEnv.ExprBindings, BlkExpr, X); // If the block expr's value is a memory region, then mark that region. if (isa(X)) { @@ -213,7 +213,7 @@ EnvironmentManager::RemoveDeadBindings(Environment Env, // beginning of itself, but we need its UndefinedVal to determine its // SVal. if (X.isUndef() && cast(X).getData()) - NewEnv.ExprBindings = F.Add(NewEnv.ExprBindings, BlkExpr, X); + NewEnv.ExprBindings = F.add(NewEnv.ExprBindings, BlkExpr, X); } // Go through he deferred locations and add them to the new environment if @@ -222,7 +222,7 @@ EnvironmentManager::RemoveDeadBindings(Environment Env, I = deferredLocations.begin(), E = deferredLocations.end(); I != E; ++I) { const Stmt *S = (Stmt*) (((uintptr_t) I->first) & (uintptr_t) ~0x1); if (NewEnv.ExprBindings.lookup(S)) - NewEnv.ExprBindings = F.Add(NewEnv.ExprBindings, I->first, I->second); + NewEnv.ExprBindings = F.add(NewEnv.ExprBindings, I->first, I->second); } return NewEnv; diff --git a/lib/Checker/FlatStore.cpp b/lib/Checker/FlatStore.cpp index 21fa422166..bda7a632e2 100644 --- a/lib/Checker/FlatStore.cpp +++ b/lib/Checker/FlatStore.cpp @@ -36,7 +36,7 @@ public: const LocationContext *LC, SVal v); Store getInitialStore(const LocationContext *InitLoc) { - return RBFactory.GetEmptyMap().getRoot(); + return RBFactory.getEmptyMap().getRoot(); } SubRegionMap *getSubRegionMap(Store store) { @@ -97,7 +97,7 @@ SVal FlatStoreManager::Retrieve(Store store, Loc L, QualType T) { RegionBindings B = getRegionBindings(store); const BindingVal *BV = B.lookup(RI.R); if (BV) { - const SVal *V = BVFactory.Lookup(*BV, RI.I); + const SVal *V = BVFactory.lookup(*BV, RI.I); if (V) return *V; else @@ -119,7 +119,7 @@ Store FlatStoreManager::Bind(Store store, Loc L, SVal val) { RegionBindings B = getRegionBindings(store); const BindingVal *V = B.lookup(R); - BindingVal BV = BVFactory.GetEmptyMap(); + BindingVal BV = BVFactory.getEmptyMap(); if (V) BV = *V; @@ -127,8 +127,8 @@ Store FlatStoreManager::Bind(Store store, Loc L, SVal val) { // FIXME: FlatStore should handle regions with unknown intervals. if (!RI.R) return B.getRoot(); - BV = BVFactory.Add(BV, RI.I, val); - B = RBFactory.Add(B, RI.R, BV); + BV = BVFactory.add(BV, RI.I, val); + B = RBFactory.add(B, RI.R, BV); return B.getRoot(); } diff --git a/lib/Checker/GRBlockCounter.cpp b/lib/Checker/GRBlockCounter.cpp index cd26060ef0..75fb16a2d5 100644 --- a/lib/Checker/GRBlockCounter.cpp +++ b/lib/Checker/GRBlockCounter.cpp @@ -74,12 +74,12 @@ GRBlockCounter GRBlockCounter::Factory::IncrementCount(GRBlockCounter BC, const StackFrameContext *CallSite, unsigned BlockID) { - return GRBlockCounter(GetFactory(F).Add(GetMap(BC.Data), + return GRBlockCounter(GetFactory(F).add(GetMap(BC.Data), CountKey(CallSite, BlockID), BC.getNumVisited(CallSite, BlockID)+1).getRoot()); } GRBlockCounter GRBlockCounter::Factory::GetEmptyCounter() { - return GRBlockCounter(GetFactory(F).GetEmptyMap().getRoot()); + return GRBlockCounter(GetFactory(F).getEmptyMap().getRoot()); } diff --git a/lib/Checker/GRState.cpp b/lib/Checker/GRState.cpp index dbbcb39aa0..86b6f81658 100644 --- a/lib/Checker/GRState.cpp +++ b/lib/Checker/GRState.cpp @@ -64,7 +64,7 @@ const GRState *GRStateManager::MarshalState(const GRState *state, GRState State(this, EnvMgr.getInitialEnvironment(), StoreMgr->getInitialStore(InitLoc), - GDMFactory.GetEmptyMap()); + GDMFactory.getEmptyMap()); return getPersistentState(State); } @@ -278,7 +278,7 @@ const GRState* GRStateManager::getInitialState(const LocationContext *InitLoc) { GRState State(this, EnvMgr.getInitialEnvironment(), StoreMgr->getInitialStore(InitLoc), - GDMFactory.GetEmptyMap()); + GDMFactory.getEmptyMap()); return getPersistentState(State); } @@ -420,7 +420,7 @@ GRStateManager::FindGDMContext(void* K, const GRState* GRStateManager::addGDM(const GRState* St, void* Key, void* Data){ GRState::GenericDataMap M1 = St->getGDM(); - GRState::GenericDataMap M2 = GDMFactory.Add(M1, Key, Data); + GRState::GenericDataMap M2 = GDMFactory.add(M1, Key, Data); if (M1 == M2) return St; @@ -432,7 +432,7 @@ const GRState* GRStateManager::addGDM(const GRState* St, void* Key, void* Data){ const GRState *GRStateManager::removeGDM(const GRState *state, void *Key) { GRState::GenericDataMap OldM = state->getGDM(); - GRState::GenericDataMap NewM = GDMFactory.Remove(OldM, Key); + GRState::GenericDataMap NewM = GDMFactory.remove(OldM, Key); if (NewM == OldM) return state; diff --git a/lib/Checker/MallocChecker.cpp b/lib/Checker/MallocChecker.cpp index c9b6d7588b..2456b1d659 100644 --- a/lib/Checker/MallocChecker.cpp +++ b/lib/Checker/MallocChecker.cpp @@ -587,7 +587,7 @@ void MallocChecker::EvalDeadSymbols(CheckerContext &C,SymbolReaper &SymReaper) { } // Remove the dead symbol from the map. - RS = F.Remove(RS, I->first); + RS = F.remove(RS, I->first); } } diff --git a/lib/Checker/RangeConstraintManager.cpp b/lib/Checker/RangeConstraintManager.cpp index 697694e72a..0a15c2ad04 100644 --- a/lib/Checker/RangeConstraintManager.cpp +++ b/lib/Checker/RangeConstraintManager.cpp @@ -91,7 +91,7 @@ public: /// Construct a new RangeSet representing '{ [from, to] }'. RangeSet(Factory &F, const llvm::APSInt &from, const llvm::APSInt &to) - : ranges(F.Add(F.GetEmptySet(), Range(from, to))) {} + : ranges(F.add(F.getEmptySet(), Range(from, to))) {} /// Profile - Generates a hash profile of this RangeSet for use /// by FoldingSet. @@ -129,17 +129,17 @@ private: if (i->Includes(Lower)) { if (i->Includes(Upper)) { - newRanges = F.Add(newRanges, Range(BV.getValue(Lower), + newRanges = F.add(newRanges, Range(BV.getValue(Lower), BV.getValue(Upper))); break; } else - newRanges = F.Add(newRanges, Range(BV.getValue(Lower), i->To())); + newRanges = F.add(newRanges, Range(BV.getValue(Lower), i->To())); } else { if (i->Includes(Upper)) { - newRanges = F.Add(newRanges, Range(i->From(), BV.getValue(Upper))); + newRanges = F.add(newRanges, Range(i->From(), BV.getValue(Upper))); break; } else - newRanges = F.Add(newRanges, *i); + newRanges = F.add(newRanges, *i); } } } @@ -155,7 +155,7 @@ public: RangeSet Intersect(BasicValueFactory &BV, Factory &F, const llvm::APSInt &Lower, const llvm::APSInt &Upper) const { - PrimRangeSet newRanges = F.GetEmptySet(); + PrimRangeSet newRanges = F.getEmptySet(); PrimRangeSet::iterator i = begin(), e = end(); if (Lower <= Upper) @@ -274,7 +274,7 @@ RangeConstraintManager::RemoveDeadBindings(const GRState* state, for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) { SymbolRef sym = I.getKey(); if (SymReaper.maybeDead(sym)) - CR = CRFactory.Remove(CR, sym); + CR = CRFactory.remove(CR, sym); } return state->set(CR); diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp index 144c925b8c..e5b1bca5d8 100644 --- a/lib/Checker/RegionStore.cpp +++ b/lib/Checker/RegionStore.cpp @@ -148,11 +148,11 @@ public: Map::iterator I = M.find(Parent); if (I == M.end()) { - M.insert(std::make_pair(Parent, F.Add(F.GetEmptySet(), SubRegion))); + M.insert(std::make_pair(Parent, F.add(F.getEmptySet(), SubRegion))); return true; } - I->second = F.Add(I->second, SubRegion); + I->second = F.add(I->second, SubRegion); return false; } @@ -227,7 +227,7 @@ public: SVal EvalBinOp(BinaryOperator::Opcode Op,Loc L, NonLoc R, QualType resultTy); Store getInitialStore(const LocationContext *InitLoc) { - return RBFactory.GetEmptyMap().getRoot(); + return RBFactory.getEmptyMap().getRoot(); } //===-------------------------------------------------------------------===// @@ -247,20 +247,21 @@ public: // Made public for helper classes. void RemoveSubRegionBindings(RegionBindings &B, const MemRegion *R, RegionStoreSubRegionMap &M); - RegionBindings Add(RegionBindings B, BindingKey K, SVal V); + RegionBindings addBinding(RegionBindings B, BindingKey K, SVal V); - RegionBindings Add(RegionBindings B, const MemRegion *R, + RegionBindings addBinding(RegionBindings B, const MemRegion *R, BindingKey::Kind k, SVal V); - const SVal *Lookup(RegionBindings B, BindingKey K); - const SVal *Lookup(RegionBindings B, const MemRegion *R, BindingKey::Kind k); + const SVal *lookup(RegionBindings B, BindingKey K); + const SVal *lookup(RegionBindings B, const MemRegion *R, BindingKey::Kind k); - RegionBindings Remove(RegionBindings B, BindingKey K); - RegionBindings Remove(RegionBindings B, const MemRegion *R, + RegionBindings removeBinding(RegionBindings B, BindingKey K); + RegionBindings removeBinding(RegionBindings B, const MemRegion *R, BindingKey::Kind k); - RegionBindings Remove(RegionBindings B, const MemRegion *R) { - return Remove(Remove(B, R, BindingKey::Direct), R, BindingKey::Default); + RegionBindings removeBinding(RegionBindings B, const MemRegion *R) { + return removeBinding(removeBinding(B, R, BindingKey::Direct), R, + BindingKey::Default); } public: // Part of public interface to class. @@ -270,9 +271,9 @@ public: // Part of public interface to class. // BindDefault is only used to initialize a region with a default value. Store BindDefault(Store store, const MemRegion *R, SVal V) { RegionBindings B = GetRegionBindings(store); - assert(!Lookup(B, R, BindingKey::Default)); - assert(!Lookup(B, R, BindingKey::Direct)); - return Add(B, R, BindingKey::Default, V).getRoot(); + assert(!lookup(B, R, BindingKey::Default)); + assert(!lookup(B, R, BindingKey::Direct)); + return addBinding(B, R, BindingKey::Default, V).getRoot(); } Store BindCompoundLiteral(Store store, const CompoundLiteralExpr* CL, @@ -560,7 +561,7 @@ void RegionStoreManager::RemoveSubRegionBindings(RegionBindings &B, I != E; ++I) RemoveSubRegionBindings(B, *I, M); - B = Remove(B, R); + B = removeBinding(B, R); } namespace { @@ -622,10 +623,10 @@ void InvalidateRegionsWorker::VisitCluster(const MemRegion *baseR, for ( ; I != E; ++I) { // Get the old binding. Is it a region? If so, add it to the worklist. const BindingKey &K = *I; - if (const SVal *V = RM.Lookup(B, K)) + if (const SVal *V = RM.lookup(B, K)) VisitBinding(*V); - B = RM.Remove(B, K); + B = RM.removeBinding(B, K); } } @@ -657,9 +658,9 @@ void InvalidateRegionsWorker::VisitBaseRegion(const MemRegion *baseR) { if (isa(baseR) || isa(baseR)) { // Invalidate the region by setting its default value to // conjured symbol. The type of the symbol is irrelavant. - DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(baseR, Ex, Ctx.IntTy, - Count); - B = RM.Add(B, baseR, BindingKey::Default, V); + DefinedOrUnknownSVal V = + ValMgr.getConjuredSymbolVal(baseR, Ex, Ctx.IntTy, Count); + B = RM.addBinding(B, baseR, BindingKey::Default, V); return; } @@ -675,7 +676,7 @@ void InvalidateRegionsWorker::VisitBaseRegion(const MemRegion *baseR) { // conjured symbol. The type of the symbol is irrelavant. DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(baseR, Ex, Ctx.IntTy, Count); - B = RM.Add(B, baseR, BindingKey::Default, V); + B = RM.addBinding(B, baseR, BindingKey::Default, V); return; } @@ -683,7 +684,7 @@ void InvalidateRegionsWorker::VisitBaseRegion(const MemRegion *baseR) { // Set the default value of the array to conjured symbol. DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(baseR, Ex, AT->getElementType(), Count); - B = RM.Add(B, baseR, BindingKey::Default, V); + B = RM.addBinding(B, baseR, BindingKey::Default, V); return; } @@ -692,14 +693,14 @@ void InvalidateRegionsWorker::VisitBaseRegion(const MemRegion *baseR) { // If the region is a global and we are invalidating all globals, // just erase the entry. This causes all globals to be lazily // symbolicated from the same base symbol. - B = RM.Remove(B, baseR); + B = RM.removeBinding(B, baseR); return; } DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(baseR, Ex, T, Count); assert(SymbolManager::canSymbolicate(T) || V.isUnknown()); - B = RM.Add(B, baseR, BindingKey::Direct, V); + B = RM.addBinding(B, baseR, BindingKey::Direct, V); } Store RegionStoreManager::InvalidateRegions(Store store, @@ -733,7 +734,7 @@ Store RegionStoreManager::InvalidateRegions(Store store, ValMgr.getConjuredSymbolVal(/* SymbolTag = */ (void*) GS, Ex, /* symbol type, doesn't matter */ Ctx.IntTy, Count); - B = Add(B, BindingKey::Make(GS, BindingKey::Default), V); + B = addBinding(B, BindingKey::Make(GS, BindingKey::Default), V); // Even if there are no bindings in the global scope, we still need to // record that we touched it. @@ -929,7 +930,7 @@ SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R, Optional RegionStoreManager::getDirectBinding(RegionBindings B, const MemRegion *R) { - if (const SVal *V = Lookup(B, R, BindingKey::Direct)) + if (const SVal *V = lookup(B, R, BindingKey::Direct)) return *V; return Optional(); @@ -942,7 +943,7 @@ Optional RegionStoreManager::getDefaultBinding(RegionBindings B, if (TR->getValueType()->isUnionType()) return UnknownVal(); - if (const SVal *V = Lookup(B, R, BindingKey::Default)) + if (const SVal *V = lookup(B, R, BindingKey::Default)) return *V; return Optional(); @@ -1038,7 +1039,7 @@ SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) { } RegionBindings B = GetRegionBindings(store); - const SVal *V = Lookup(B, R, BindingKey::Direct); + const SVal *V = lookup(B, R, BindingKey::Direct); // Check if the region has a binding. if (V) @@ -1339,7 +1340,7 @@ SVal RegionStoreManager::RetrieveArray(Store store, const TypedRegion * R) { Store RegionStoreManager::Remove(Store store, Loc L) { if (isa(L)) if (const MemRegion* R = cast(L).getRegion()) - return Remove(GetRegionBindings(store), R).getRoot(); + return removeBinding(GetRegionBindings(store), R).getRoot(); return store; } @@ -1385,7 +1386,7 @@ Store RegionStoreManager::Bind(Store store, Loc L, SVal V) { // Perform the binding. RegionBindings B = GetRegionBindings(store); - return Add(B, R, BindingKey::Direct, V).getRoot(); + return addBinding(B, R, BindingKey::Direct, V).getRoot(); } Store RegionStoreManager::BindDecl(Store store, const VarRegion *VR, @@ -1430,7 +1431,7 @@ Store RegionStoreManager::setImplicitDefaultValue(Store store, return store; } - return Add(B, R, BindingKey::Default, V).getRoot(); + return addBinding(B, R, BindingKey::Default, V).getRoot(); } Store RegionStoreManager::BindArray(Store store, const TypedRegion* R, @@ -1541,7 +1542,7 @@ Store RegionStoreManager::BindStruct(Store store, const TypedRegion* R, // There may be fewer values in the initialize list than the fields of struct. if (FI != FE) { RegionBindings B = GetRegionBindings(store); - B = Add(B, R, BindingKey::Default, ValMgr.makeIntVal(0, false)); + B = addBinding(B, R, BindingKey::Default, ValMgr.makeIntVal(0, false)); store = B.getRoot(); } @@ -1556,7 +1557,7 @@ Store RegionStoreManager::KillStruct(Store store, const TypedRegion* R, RemoveSubRegionBindings(B, R, *SubRegions); // Set the default value of the struct region to "unknown". - return Add(B, R, BindingKey::Default, DefaultVal).getRoot(); + return addBinding(B, R, BindingKey::Default, DefaultVal).getRoot(); } Store RegionStoreManager::CopyLazyBindings(nonloc::LazyCompoundVal V, @@ -1573,7 +1574,7 @@ Store RegionStoreManager::CopyLazyBindings(nonloc::LazyCompoundVal V, // Now copy the bindings. This amounts to just binding 'V' to 'R'. This // results in a zero-copy algorithm. - return Add(B, R, BindingKey::Direct, V).getRoot(); + return addBinding(B, R, BindingKey::Direct, V).getRoot(); } //===----------------------------------------------------------------------===// @@ -1581,38 +1582,42 @@ Store RegionStoreManager::CopyLazyBindings(nonloc::LazyCompoundVal V, //===----------------------------------------------------------------------===// -RegionBindings RegionStoreManager::Add(RegionBindings B, BindingKey K, SVal V) { +RegionBindings RegionStoreManager::addBinding(RegionBindings B, BindingKey K, + SVal V) { if (!K.isValid()) return B; - return RBFactory.Add(B, K, V); + return RBFactory.add(B, K, V); } -RegionBindings RegionStoreManager::Add(RegionBindings B, const MemRegion *R, - BindingKey::Kind k, SVal V) { - return Add(B, BindingKey::Make(R, k), V); +RegionBindings RegionStoreManager::addBinding(RegionBindings B, + const MemRegion *R, + BindingKey::Kind k, SVal V) { + return addBinding(B, BindingKey::Make(R, k), V); } -const SVal *RegionStoreManager::Lookup(RegionBindings B, BindingKey K) { +const SVal *RegionStoreManager::lookup(RegionBindings B, BindingKey K) { if (!K.isValid()) return NULL; return B.lookup(K); } -const SVal *RegionStoreManager::Lookup(RegionBindings B, +const SVal *RegionStoreManager::lookup(RegionBindings B, const MemRegion *R, BindingKey::Kind k) { - return Lookup(B, BindingKey::Make(R, k)); + return lookup(B, BindingKey::Make(R, k)); } -RegionBindings RegionStoreManager::Remove(RegionBindings B, BindingKey K) { +RegionBindings RegionStoreManager::removeBinding(RegionBindings B, + BindingKey K) { if (!K.isValid()) return B; - return RBFactory.Remove(B, K); + return RBFactory.remove(B, K); } -RegionBindings RegionStoreManager::Remove(RegionBindings B, const MemRegion *R, - BindingKey::Kind k){ - return Remove(B, BindingKey::Make(R, k)); +RegionBindings RegionStoreManager::removeBinding(RegionBindings B, + const MemRegion *R, + BindingKey::Kind k){ + return removeBinding(B, BindingKey::Make(R, k)); } //===----------------------------------------------------------------------===// @@ -1738,7 +1743,7 @@ void RemoveDeadBindingsWorker::VisitBindingKey(BindingKey K) { } // Visit the data binding for K. - if (const SVal *V = RM.Lookup(B, K)) + if (const SVal *V = RM.lookup(B, K)) VisitBinding(*V); } @@ -1787,7 +1792,7 @@ Store RegionStoreManager::RemoveDeadBindings(Store store, continue; // Remove the dead entry. - B = Remove(B, K); + B = removeBinding(B, K); // Mark all non-live symbols that this binding references as dead. if (const SymbolicRegion* SymR = dyn_cast(K.getRegion()))