diff options
author | Anna Zaks <ganna@apple.com> | 2011-10-24 21:19:43 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-10-24 21:19:43 +0000 |
commit | f185cc1ac77a84139c603eee3473b88dcb839c68 (patch) | |
tree | 2df712f693797a0180653df18e2c528b368805fa /lib/StaticAnalyzer/Core/ExprEngine.cpp | |
parent | 41bf4f38348561a0f12c10d34f1673cd19a6eb04 (diff) |
[analyzer] Remove more dependencies from global Builder
- OSAtomicChecker
- ExprEngine::processStmt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142846 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/ExprEngine.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index 0b40c9aa4d..2806b51a8f 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -267,7 +267,7 @@ void ExprEngine::ProcessStmt(const CFGStmt S, ExplodedNode *Pred) { ExplodedNodeSet TopDst; StmtNodeBuilder builder(Pred, TopDst, currentStmtIdx, *currentBuilderContext); - + Builder = &builder; // TODO: Use RAII to remove the unnecessary, tagged nodes. //RegisterCreatedNodes registerCreatedNodes(getGraph()); @@ -281,14 +281,10 @@ void ExprEngine::ProcessStmt(const CFGStmt S, currentStmt->getLocStart(), "Error evaluating statement"); - // A tag to track convenience transitions, which can be removed at cleanup. - static SimpleProgramPointTag cleanupTag("ExprEngine : Clean Node"); - Builder = &builder; EntryNode = Pred; const ProgramState *EntryState = EntryNode->getState(); CleanedState = EntryState; - ExplodedNode *CleanedNode = 0; // Create the cleaned state. const LocationContext *LC = EntryNode->getLocationContext(); @@ -307,21 +303,17 @@ void ExprEngine::ProcessStmt(const CFGStmt S, // Process any special transfer function for dead symbols. ExplodedNodeSet Tmp; + // A tag to track convenience transitions, which can be removed at cleanup. + static SimpleProgramPointTag cleanupTag("ExprEngine : Clean Node"); + if (!SymReaper.hasDeadSymbols()) { // Generate a CleanedNode that has the environment and store cleaned // up. Since no symbols are dead, we can optimize and not clean out // the constraint manager. - CleanedNode = - builder.generateNode(currentStmt, CleanedState, EntryNode, &cleanupTag); - Tmp.Add(CleanedNode); + PureStmtNodeBuilder Bldr(Pred, Tmp, *currentBuilderContext); + Bldr.generateNode(currentStmt, EntryNode, CleanedState, false, &cleanupTag); } else { - SaveAndRestore<bool> OldSink(builder.BuildSinks); - SaveOr OldHasGen(builder.hasGeneratedNode); - - SaveAndRestore<bool> OldPurgeDeadSymbols(builder.PurgingDeadSymbols); - builder.PurgingDeadSymbols = true; - // Call checkers with the non-cleaned state so that they could query the // values of the soon to be dead symbols. ExplodedNodeSet CheckedSet; @@ -331,6 +323,7 @@ void ExprEngine::ProcessStmt(const CFGStmt S, // For each node in CheckedSet, generate CleanedNodes that have the // environment, the store, and the constraints cleaned up but have the // user-supplied states as the predecessors. + PureStmtNodeBuilder Bldr(CheckedSet, Tmp, *currentBuilderContext); for (ExplodedNodeSet::const_iterator I = CheckedSet.begin(), E = CheckedSet.end(); I != E; ++I) { const ProgramState *CheckerState = (*I)->getState(); @@ -350,10 +343,8 @@ void ExprEngine::ProcessStmt(const CFGStmt S, // generate a transition to that state. const ProgramState *CleanedCheckerSt = StateMgr.getPersistentStateWithGDM(CleanedState, CheckerState); - ExplodedNode *CleanedNode = builder.generateNode(currentStmt, - CleanedCheckerSt, *I, - &cleanupTag); - Tmp.Add(CleanedNode); + Bldr.generateNode(currentStmt, *I, CleanedCheckerSt, false, &cleanupTag, + ProgramPoint::PostPurgeDeadSymbolsKind); } } |