[clang] bbc8662 - [analyzer] NFC: Don't clean up range constraints twice.
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 21 18:59:55 PST 2019
Author: Artem Dergachev
Date: 2019-11-21T18:59:46-08:00
New Revision: bbc8662db1548f98b1c475cadf6260f9079c11ea
URL: https://github.com/llvm/llvm-project/commit/bbc8662db1548f98b1c475cadf6260f9079c11ea
DIFF: https://github.com/llvm/llvm-project/commit/bbc8662db1548f98b1c475cadf6260f9079c11ea.diff
LOG: [analyzer] NFC: Don't clean up range constraints twice.
Slightly improves static analysis speed.
Differential Revision: https://reviews.llvm.org/D70150
Added:
Modified:
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
clang/lib/StaticAnalyzer/Core/ProgramState.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
index 07920790c80a..bdd12a3ffe33 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -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:
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index d63288216220..a2e2eec97683 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -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.
diff --git a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
index f50d82de3b28..14006f79fd0f 100644
--- a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -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
@@ -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,
More information about the cfe-commits
mailing list