Check in a new interface of Checker, which will soon be used.

llvm-svn: 87092
This commit is contained in:
Zhongxing Xu 2009-11-13 06:53:04 +00:00
parent 0320ad28c7
commit a4276b091d
2 changed files with 33 additions and 1 deletions

View File

@ -153,6 +153,14 @@ private:
VisitLocation(C, S, location);
}
void GR_EvalDeadSymbols(ExplodedNodeSet &Dst, GRStmtNodeBuilder &Builder,
GRExprEngine &Eng, const Stmt *S, ExplodedNode *Pred,
SymbolReaper &SymReaper, void *tag) {
CheckerContext C(Dst, Builder, Eng, Pred, tag,
ProgramPoint::PostPurgeDeadSymbolsKind, Pred->getState());
EvalDeadSymbols(C, S, SymReaper);
}
public:
virtual ~Checker() {}
virtual void _PreVisit(CheckerContext &C, const Stmt *S) {}
@ -160,6 +168,8 @@ public:
virtual void VisitLocation(CheckerContext &C, const Stmt *S, SVal location) {}
virtual void PreVisitBind(CheckerContext &C, const Stmt *AssignE,
const Stmt *StoreE, SVal location, SVal val) {}
virtual void EvalDeadSymbols(CheckerContext &C, const Stmt *S,
SymbolReaper &SymReaper) {}
};
} // end clang namespace

View File

@ -318,9 +318,31 @@ void GRExprEngine::ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) {
SaveAndRestore<bool> OldPurgeDeadSymbols(Builder->PurgingDeadSymbols);
Builder->PurgingDeadSymbols = true;
getTF().EvalDeadSymbols(Tmp, *this, *Builder, EntryNode, S,
// FIXME: This should soon be removed.
ExplodedNodeSet Tmp2;
getTF().EvalDeadSymbols(Tmp2, *this, *Builder, EntryNode, S,
CleanedState, SymReaper);
if (Checkers.empty())
Tmp = Tmp2;
else {
ExplodedNodeSet Tmp3;
ExplodedNodeSet *SrcSet = &Tmp2;
for (CheckersOrdered::iterator I = Checkers.begin(), E = Checkers.end();
I != E; ++I) {
ExplodedNodeSet *DstSet = (I+1 == E) ? &Tmp
: (SrcSet == &Tmp2) ? &Tmp3
: &Tmp2;
void *tag = I->first;
Checker *checker = I->second;
for (ExplodedNodeSet::iterator NI = SrcSet->begin(), NE = SrcSet->end();
NI != NE; ++NI)
checker->GR_EvalDeadSymbols(*DstSet, *Builder, *this, S, *NI,
SymReaper, tag);
SrcSet = DstSet;
}
}
if (!Builder->BuildSinks && !Builder->HasGeneratedNode)
Tmp.Add(EntryNode);
}