From 3812b7676cfee4f9c4730d425182c4fd201d4946 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 24 Apr 2008 18:31:42 +0000 Subject: Added initial boilerplate in GRExprEngine to allow checker-specific transfer function logic to act when symbols become dead. llvm-svn: 50221 --- clang/lib/Analysis/GRExprEngine.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'clang/lib/Analysis/GRExprEngine.cpp') diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index a6d8ef90517..a287e542981 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/lib/Analysis/GRExprEngine.cpp @@ -188,13 +188,34 @@ void GRExprEngine::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) { // Create the cleaned state. CleanedState = StateMgr.RemoveDeadBindings(StmtEntryNode->getState(), - CurrentStmt, Liveness); + CurrentStmt, Liveness, + DeadSymbols); - Builder->SetCleanedState(CleanedState); + // Process any special transfer function for dead symbols. - // Visit the statement. + NodeSet Tmp; - Visit(S, StmtEntryNode, Dst); + if (DeadSymbols.empty()) + Tmp.Add(StmtEntryNode); + else { + SaveAndRestore OldSink(Builder->BuildSinks); +/* + FIXME: Will hook this up next. + + TF->EvalDeadSymbols(Tmp, *this, *Builder, StmtEntryNode->getLocation(), Pred, + CleanedState, DeadSymbols); +*/ + if (!Builder->BuildSinks && Tmp.empty() && !Builder->HasGeneratedNode) + Tmp.Add(StmtEntryNode); + } + + for (NodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) { + // Set the cleaned state. + Builder->SetCleanedState(*I == StmtEntryNode ? CleanedState : (*I)->getState()); + + // Visit the statement. + Visit(S, StmtEntryNode, Dst); + } // If no nodes were generated, generate a new node that has all the // dead mappings removed. -- cgit v1.2.3