Skip to content

Commit bbc8662

Browse files
committed
[analyzer] NFC: Don't clean up range constraints twice.
Slightly improves static analysis speed. Differential Revision: https://reviews.llvm.org/D70150
1 parent b29e5cd commit bbc8662

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,10 @@ class ProgramStateManager {
533533
ConstraintManager &getConstraintManager() { return *ConstraintMgr; }
534534
SubEngine &getOwningEngine() { return *Eng; }
535535

536-
ProgramStateRef removeDeadBindings(ProgramStateRef St,
537-
const StackFrameContext *LCtx,
538-
SymbolReaper& SymReaper);
536+
ProgramStateRef
537+
removeDeadBindingsFromEnvironmentAndStore(ProgramStateRef St,
538+
const StackFrameContext *LCtx,
539+
SymbolReaper &SymReaper);
539540

540541
public:
541542

clang/lib/StaticAnalyzer/Core/ExprEngine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,8 @@ void ExprEngine::removeDead(ExplodedNode *Pred, ExplodedNodeSet &Out,
728728
// Create a state in which dead bindings are removed from the environment
729729
// and the store. TODO: The function should just return new env and store,
730730
// not a new state.
731-
CleanedState = StateMgr.removeDeadBindings(CleanedState, SFC, SymReaper);
731+
CleanedState = StateMgr.removeDeadBindingsFromEnvironmentAndStore(
732+
CleanedState, SFC, SymReaper);
732733

733734
// Process any special transfer function for dead symbols.
734735
// A tag to track convenience transitions, which can be removed at cleanup.

clang/lib/StaticAnalyzer/Core/ProgramState.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ ProgramStateManager::~ProgramStateManager() {
9191
I->second.second(I->second.first);
9292
}
9393

94-
ProgramStateRef
95-
ProgramStateManager::removeDeadBindings(ProgramStateRef state,
96-
const StackFrameContext *LCtx,
97-
SymbolReaper& SymReaper) {
94+
ProgramStateRef ProgramStateManager::removeDeadBindingsFromEnvironmentAndStore(
95+
ProgramStateRef state, const StackFrameContext *LCtx,
96+
SymbolReaper &SymReaper) {
9897

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

115-
ProgramStateRef Result = getPersistentState(NewState);
116-
return ConstraintMgr->removeDeadBindings(Result, SymReaper);
114+
return getPersistentState(NewState);
117115
}
118116

119117
ProgramStateRef ProgramState::bindLoc(Loc LV,

0 commit comments

Comments
 (0)