[cfe-commits] r53172 - in /cfe/trunk/lib/Analysis: CFRefCount.cpp GRBlockCounter.cpp ValueState.cpp
Ted Kremenek
kremenek at apple.com
Mon Jul 7 09:21:19 PDT 2008
Author: kremenek
Date: Mon Jul 7 11:21:19 2008
New Revision: 53172
URL: http://llvm.org/viewvc/llvm-project?rev=53172&view=rev
Log:
Updated clients of ImmutableMap::SlimFind to use ImmutableMap::lookup instead.
Modified:
cfe/trunk/lib/Analysis/CFRefCount.cpp
cfe/trunk/lib/Analysis/GRBlockCounter.cpp
cfe/trunk/lib/Analysis/ValueState.cpp
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=53172&r1=53171&r2=53172&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Mon Jul 7 11:21:19 2008
@@ -1377,13 +1377,13 @@
SymbolID Sym = cast<lval::SymbolVal>(V).getSymbol();
RefBindings B = GetRefBindings(StVals);
- if (RefBindings::TreeTy* T = B.SlimFind(Sym)) {
- B = Update(B, Sym, T->getValue().second, GetArgE(Summ, idx), hasErr);
+ if (RefBindings::data_type* T = B.lookup(Sym)) {
+ B = Update(B, Sym, *T, GetArgE(Summ, idx), hasErr);
SetRefBindings(StVals, B);
if (hasErr) {
ErrorExpr = *I;
- ErrorSym = T->getValue().first;
+ ErrorSym = Sym;
break;
}
}
@@ -1431,13 +1431,13 @@
SymbolID Sym = cast<lval::SymbolVal>(V).getSymbol();
RefBindings B = GetRefBindings(StVals);
- if (RefBindings::TreeTy* T = B.SlimFind(Sym)) {
- B = Update(B, Sym, T->getValue().second, GetReceiverE(Summ), hasErr);
+ if (const RefVal* T = B.lookup(Sym)) {
+ B = Update(B, Sym, *T, GetReceiverE(Summ), hasErr);
SetRefBindings(StVals, B);
if (hasErr) {
ErrorExpr = Receiver;
- ErrorSym = T->getValue().first;
+ ErrorSym = Sym;
}
}
}
@@ -1581,8 +1581,8 @@
if (isa<lval::SymbolVal>(V)) {
SymbolID Sym = cast<lval::SymbolVal>(V).getSymbol();
- if (RefBindings::TreeTy* T = GetRefBindings(*St).SlimFind(Sym)) {
- QualType Ty = T->getValue().second.getType();
+ if (const RefVal* T = GetRefBindings(*St).lookup(Sym)) {
+ QualType Ty = T->getType();
if (const PointerType* PT = Ty->getAsPointerType()) {
QualType PointeeTy = PT->getPointeeType();
@@ -1630,10 +1630,8 @@
return;
SymbolID Sym = cast<lval::SymbolVal>(Val).getSymbol();
- RefBindings B = GetRefBindings(*St);
- RefBindings::TreeTy* T = B.SlimFind(Sym);
- if (!T)
+ if (!GetRefBindings(*St).lookup(Sym))
return;
// Nuke the binding.
@@ -1723,17 +1721,17 @@
for (ValueStateManager::DeadSymbolsTy::const_iterator
I=Dead.begin(), E=Dead.end(); I!=E; ++I) {
- RefBindings::TreeTy* T = B.SlimFind(*I);
+ const RefVal* T = B.lookup(*I);
if (!T)
continue;
bool hasLeak = false;
- St = HandleSymbolDeath(Eng.getStateManager(), St,
- *I, T->getValue().second, hasLeak);
+ St = HandleSymbolDeath(Eng.getStateManager(), St, *I, *T, hasLeak);
- if (hasLeak) Leaked.push_back(*I);
+ if (hasLeak)
+ Leaked.push_back(*I);
}
if (Leaked.empty())
@@ -1774,14 +1772,14 @@
// Get the reference count binding (if any).
SymbolID Sym = cast<lval::SymbolVal>(V).getSymbol();
RefBindings B = GetRefBindings(*St);
- RefBindings::TreeTy* T = B.SlimFind(Sym);
+ const RefVal* T = B.lookup(Sym);
if (!T)
return;
// Change the reference count.
- RefVal X = T->getValue().second;
+ RefVal X = *T;
switch (X.getKind()) {
@@ -2122,14 +2120,14 @@
CFRefCount::RefBindings PrevB = CFRefCount::GetRefBindings(*PrevSt);
CFRefCount::RefBindings CurrB = CFRefCount::GetRefBindings(*CurrSt);
- CFRefCount::RefBindings::TreeTy* PrevT = PrevB.SlimFind(Sym);
- CFRefCount::RefBindings::TreeTy* CurrT = CurrB.SlimFind(Sym);
+ const RefVal* PrevT = PrevB.lookup(Sym);
+ const RefVal* CurrT = CurrB.lookup(Sym);
if (!CurrT)
return NULL;
const char* Msg = NULL;
- RefVal CurrV = CurrB.SlimFind(Sym)->getValue().second;
+ const RefVal& CurrV = *CurrB.lookup(Sym);
if (!PrevT) {
@@ -2168,9 +2166,8 @@
return P;
}
- // Determine if the typestate has changed.
-
- RefVal PrevV = PrevB.SlimFind(Sym)->getValue().second;
+ // Determine if the typestate has changed.
+ RefVal PrevV = *PrevB.lookup(Sym);
if (PrevV == CurrV)
return NULL;
@@ -2258,9 +2255,8 @@
while (N) {
ValueState* St = N->getState();
RefBindings B = RefBindings((RefBindings::TreeTy*) St->CheckerState);
- RefBindings::TreeTy* T = B.SlimFind(Sym);
- if (!T)
+ if (!B.lookup(Sym))
break;
VarDecl* VD = 0;
@@ -2301,16 +2297,10 @@
typedef CFRefCount::RefBindings RefBindings;
// Get the retain count.
- unsigned long RetCount = 0;
-
- {
- ValueState* St = EndN->getState();
- RefBindings B = RefBindings((RefBindings::TreeTy*) St->CheckerState);
- RefBindings::TreeTy* T = B.SlimFind(Sym);
- assert (T);
- RetCount = T->getValue().second.getCount();
- }
+ unsigned long RetCount =
+ CFRefCount::GetRefBindings(*EndN->getState()).lookup(Sym)->getCount();
+
// We are a leak. Walk up the graph to get to the first node where the
// symbol appeared, and also get the first VarDecl that tracked object
// is stored to.
Modified: cfe/trunk/lib/Analysis/GRBlockCounter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRBlockCounter.cpp?rev=53172&r1=53171&r2=53172&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRBlockCounter.cpp (original)
+++ cfe/trunk/lib/Analysis/GRBlockCounter.cpp Mon Jul 7 11:21:19 2008
@@ -30,8 +30,8 @@
unsigned GRBlockCounter::getNumVisited(unsigned BlockID) const {
CountMap M = GetMap(Data);
- CountMap::TreeTy* T = M.SlimFind(BlockID);
- return T ? T->getValue().second : 0;
+ CountMap::data_type* T = M.lookup(BlockID);
+ return T ? *T : 0;
}
GRBlockCounter::Factory::Factory(llvm::BumpPtrAllocator& Alloc) {
Modified: cfe/trunk/lib/Analysis/ValueState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ValueState.cpp?rev=53172&r1=53171&r2=53172&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ValueState.cpp (original)
+++ cfe/trunk/lib/Analysis/ValueState.cpp Mon Jul 7 11:21:19 2008
@@ -19,15 +19,15 @@
bool ValueState::isNotEqual(SymbolID sym, const llvm::APSInt& V) const {
// Retrieve the NE-set associated with the given symbol.
- ConstNotEqTy::TreeTy* T = ConstNotEq.SlimFind(sym);
+ const ConstNotEqTy::data_type* T = ConstNotEq.lookup(sym);
// See if V is present in the NE-set.
- return T ? T->getValue().second.contains(&V) : false;
+ return T ? T->contains(&V) : false;
}
const llvm::APSInt* ValueState::getSymVal(SymbolID sym) const {
- ConstEqTy::TreeTy* T = ConstEq.SlimFind(sym);
- return T ? T->getValue().second : NULL;
+ ConstEqTy::data_type* T = ConstEq.lookup(sym);
+ return T ? *T : NULL;
}
ValueState*
@@ -170,10 +170,10 @@
switch (LV.getSubKind()) {
case lval::DeclValKind: {
- ValueState::VarBindingsTy::TreeTy* T =
- St->VarBindings.SlimFind(cast<lval::DeclVal>(LV).getDecl());
+ ValueState::VarBindingsTy::data_type* T =
+ St->VarBindings.lookup(cast<lval::DeclVal>(LV).getDecl());
- return T ? T->getValue().second : UnknownVal();
+ return T ? *T : UnknownVal();
}
// FIXME: We should limit how far a "ContentsOf" will go...
@@ -233,8 +233,8 @@
const llvm::APSInt& V) {
// First, retrieve the NE-set associated with the given symbol.
- ValueState::ConstNotEqTy::TreeTy* T = St->ConstNotEq.SlimFind(sym);
- ValueState::IntSetTy S = T ? T->getValue().second : ISetFactory.GetEmptySet();
+ ValueState::ConstNotEqTy::data_type* T = St->ConstNotEq.lookup(sym);
+ ValueState::IntSetTy S = T ? *T : ISetFactory.GetEmptySet();
// Now add V to the NE set.
S = ISetFactory.Add(S, &V);
@@ -321,13 +321,13 @@
break;
}
- ValueState::ExprBindingsTy::TreeTy* T = St->SubExprBindings.SlimFind(E);
+ ValueState::ExprBindingsTy::data_type* T = St->SubExprBindings.lookup(E);
if (T)
- return T->getValue().second;
+ return *T;
- T = St->BlockExprBindings.SlimFind(E);
- return T ? T->getValue().second : UnknownVal();
+ T = St->BlockExprBindings.lookup(E);
+ return T ? *T : UnknownVal();
}
RVal ValueStateManager::GetBlkExprRVal(ValueState* St, Expr* E) {
@@ -345,8 +345,8 @@
}
default: {
- ValueState::ExprBindingsTy::TreeTy* T = St->BlockExprBindings.SlimFind(E);
- return T ? T->getValue().second : UnknownVal();
+ ValueState::ExprBindingsTy::data_type* T=St->BlockExprBindings.lookup(E);
+ return T ? *T : UnknownVal();
}
}
}
More information about the cfe-commits
mailing list