Skip to content

Commit

Permalink
[analyzer] NFC: Don't clean up range constraints twice.
Browse files Browse the repository at this point in the history
Slightly improves static analysis speed.

Differential Revision: https://reviews.llvm.org/D70150
  • Loading branch information
haoNoQ committed Nov 22, 2019
1 parent b29e5cd commit bbc8662
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,10 @@ class ProgramStateManager {
ConstraintManager &getConstraintManager() { return *ConstraintMgr; }
SubEngine &getOwningEngine() { return *Eng; }

ProgramStateRef removeDeadBindings(ProgramStateRef St,
const StackFrameContext *LCtx,
SymbolReaper& SymReaper);
ProgramStateRef
removeDeadBindingsFromEnvironmentAndStore(ProgramStateRef St,
const StackFrameContext *LCtx,
SymbolReaper &SymReaper);

public:

Expand Down
3 changes: 2 additions & 1 deletion clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ void ExprEngine::removeDead(ExplodedNode *Pred, ExplodedNodeSet &Out,
// Create a state in which dead bindings are removed from the environment
// and the store. TODO: The function should just return new env and store,
// not a new state.
CleanedState = StateMgr.removeDeadBindings(CleanedState, SFC, SymReaper);
CleanedState = StateMgr.removeDeadBindingsFromEnvironmentAndStore(
CleanedState, SFC, SymReaper);

// Process any special transfer function for dead symbols.
// A tag to track convenience transitions, which can be removed at cleanup.
Expand Down
10 changes: 4 additions & 6 deletions clang/lib/StaticAnalyzer/Core/ProgramState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ ProgramStateManager::~ProgramStateManager() {
I->second.second(I->second.first);
}

ProgramStateRef
ProgramStateManager::removeDeadBindings(ProgramStateRef state,
const StackFrameContext *LCtx,
SymbolReaper& SymReaper) {
ProgramStateRef ProgramStateManager::removeDeadBindingsFromEnvironmentAndStore(
ProgramStateRef state, const StackFrameContext *LCtx,
SymbolReaper &SymReaper) {

// This code essentially performs a "mark-and-sweep" of the VariableBindings.
// The roots are any Block-level exprs and Decls that our liveness algorithm
Expand All @@ -112,8 +111,7 @@ ProgramStateManager::removeDeadBindings(ProgramStateRef state,
NewState.setStore(newStore);
SymReaper.setReapedStore(newStore);

ProgramStateRef Result = getPersistentState(NewState);
return ConstraintMgr->removeDeadBindings(Result, SymReaper);
return getPersistentState(NewState);
}

ProgramStateRef ProgramState::bindLoc(Loc LV,
Expand Down

0 comments on commit bbc8662

Please sign in to comment.