forked from OSchip/llvm-project
Updated clients of ImmutableMap::SlimFind to use ImmutableMap::lookup instead.
llvm-svn: 53172
This commit is contained in:
parent
7c3d9cae58
commit
4963d1144f
|
@ -1377,13 +1377,13 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<ValueState>& Dst,
|
|||
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 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<ValueState>& Dst,
|
|||
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 @@ void CFRefCount::EvalObjCMessageExpr(ExplodedNodeSet<ValueState>& Dst,
|
|||
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 @@ void CFRefCount::EvalStore(ExplodedNodeSet<ValueState>& Dst,
|
|||
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 @@ void CFRefCount::EvalDeadSymbols(ExplodedNodeSet<ValueState>& Dst,
|
|||
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 @@ void CFRefCount::EvalReturn(ExplodedNodeSet<ValueState>& Dst,
|
|||
// 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 @@ PathDiagnosticPiece* CFRefReport::VisitNode(ExplodedNode<ValueState>* N,
|
|||
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 @@ PathDiagnosticPiece* CFRefReport::VisitNode(ExplodedNode<ValueState>* N,
|
|||
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 @@ GetAllocationSite(ExplodedNode<ValueState>* N, SymbolID Sym) {
|
|||
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 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& BR,
|
|||
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.
|
||||
|
|
|
@ -30,8 +30,8 @@ static inline CountMap::Factory& GetFactory(void* F) {
|
|||
|
||||
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) {
|
||||
|
|
|
@ -19,15 +19,15 @@ using namespace clang;
|
|||
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 @@ RVal ValueStateManager::GetRVal(ValueState* St, LVal LV, QualType T) {
|
|||
|
||||
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 @@ ValueState* ValueStateManager::AddNE(ValueState* St, SymbolID sym,
|
|||
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 @@ RVal ValueStateManager::GetRVal(ValueState* St, Expr* E) {
|
|||
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 @@ RVal ValueStateManager::GetBlkExprRVal(ValueState* St, Expr* E) {
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue