[PATCH] analyzer: remove dead code
Martin Liška
mliska@suse.cz
Fri Oct 23 15:26:44 GMT 2020
Hey.
I've noticed that when building GCC with Clang.
David what do you think about it?
Thanks,
Martin
gcc/analyzer/ChangeLog:
* constraint-manager.cc (constraint_manager::merge): Remove
unused code.
* constraint-manager.h: Likewise.
* program-state.cc (sm_state_map::sm_state_map): Likewise.
(program_state::program_state): Likewise.
(test_sm_state_map): Likewise.
* program-state.h: Likewise.
* region-model-reachability.cc (reachable_regions::reachable_regions): Likewise.
* region-model-reachability.h: Likewise.
* region-model.cc (region_model::handle_unrecognized_call): Likewise.
(region_model::get_reachable_svalues): Likewise.
(region_model::can_merge_with_p): Likewise.
---
gcc/analyzer/constraint-manager.cc | 11 ++++-------
gcc/analyzer/constraint-manager.h | 3 +--
gcc/analyzer/program-state.cc | 22 +++++++++++-----------
gcc/analyzer/program-state.h | 3 +--
gcc/analyzer/region-model-reachability.cc | 5 ++---
gcc/analyzer/region-model-reachability.h | 3 +--
gcc/analyzer/region-model.cc | 7 +++----
7 files changed, 23 insertions(+), 31 deletions(-)
diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc
index 603b22811c1..f9fffe45c66 100644
--- a/gcc/analyzer/constraint-manager.cc
+++ b/gcc/analyzer/constraint-manager.cc
@@ -1808,9 +1808,8 @@ class merger_fact_visitor : public fact_visitor
{
public:
merger_fact_visitor (const constraint_manager *cm_b,
- constraint_manager *out,
- const model_merger &merger)
- : m_cm_b (cm_b), m_out (out), m_merger (merger)
+ constraint_manager *out)
+ : m_cm_b (cm_b), m_out (out)
{}
void on_fact (const svalue *lhs, enum tree_code code, const svalue *rhs)
@@ -1844,7 +1843,6 @@ public:
private:
const constraint_manager *m_cm_b;
constraint_manager *m_out;
- const model_merger &m_merger;
};
/* Use MERGER to merge CM_A and CM_B into *OUT.
@@ -1856,14 +1854,13 @@ private:
void
constraint_manager::merge (const constraint_manager &cm_a,
const constraint_manager &cm_b,
- constraint_manager *out,
- const model_merger &merger)
+ constraint_manager *out)
{
/* Merge the equivalence classes and constraints.
The easiest way to do this seems to be to enumerate all of the facts
in cm_a, see which are also true in cm_b,
and add those to *OUT. */
- merger_fact_visitor v (&cm_b, out, merger);
+ merger_fact_visitor v (&cm_b, out);
cm_a.for_each_fact (&v);
}
diff --git a/gcc/analyzer/constraint-manager.h b/gcc/analyzer/constraint-manager.h
index 98960ffad84..1142b1f06e6 100644
--- a/gcc/analyzer/constraint-manager.h
+++ b/gcc/analyzer/constraint-manager.h
@@ -274,8 +274,7 @@ public:
static void merge (const constraint_manager &cm_a,
const constraint_manager &cm_b,
- constraint_manager *out,
- const model_merger &merger);
+ constraint_manager *out);
void for_each_fact (fact_visitor *) const;
diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc
index 5bb8907e340..77c2de435d6 100644
--- a/gcc/analyzer/program-state.cc
+++ b/gcc/analyzer/program-state.cc
@@ -135,8 +135,8 @@ extrinsic_state::get_model_manager () const
/* sm_state_map's ctor. */
-sm_state_map::sm_state_map (const state_machine &sm, int sm_idx)
-: m_sm (sm), m_sm_idx (sm_idx), m_map (), m_global_state (sm.get_start_state ())
+sm_state_map::sm_state_map (const state_machine &sm)
+: m_sm (sm), m_map (), m_global_state (sm.get_start_state ())
{
}
@@ -577,7 +577,7 @@ program_state::program_state (const extrinsic_state &ext_state)
const int num_states = ext_state.get_num_checkers ();
for (int i = 0; i < num_states; i++)
{
- sm_state_map *sm = new sm_state_map (ext_state.get_sm (i), i);
+ sm_state_map *sm = new sm_state_map (ext_state.get_sm (i));
m_checker_states.quick_push (sm);
}
}
@@ -1154,7 +1154,7 @@ test_sm_state_map ()
const svalue *y_sval = model.get_rvalue (y, NULL);
const svalue *z_sval = model.get_rvalue (z, NULL);
- sm_state_map map (*sm, 0);
+ sm_state_map map (*sm);
ASSERT_TRUE (map.is_empty_p ());
ASSERT_EQ (map.get_state (x_sval, ext_state), start);
@@ -1183,7 +1183,7 @@ test_sm_state_map ()
const svalue *y_sval = model.get_rvalue (y, NULL);
const svalue *z_sval = model.get_rvalue (z, NULL);
- sm_state_map map (*sm, 0);
+ sm_state_map map (*sm);
ASSERT_TRUE (map.is_empty_p ());
ASSERT_EQ (map.get_state (x_sval, ext_state), start);
ASSERT_EQ (map.get_state (y_sval, ext_state), start);
@@ -1206,9 +1206,9 @@ test_sm_state_map ()
const svalue *y_sval = model.get_rvalue (y, NULL);
const svalue *z_sval = model.get_rvalue (z, NULL);
- sm_state_map map0 (*sm, 0);
- sm_state_map map1 (*sm, 0);
- sm_state_map map2 (*sm, 0);
+ sm_state_map map0 (*sm);
+ sm_state_map map1 (*sm);
+ sm_state_map map2 (*sm);
ASSERT_EQ (map0.hash (), map1.hash ());
ASSERT_EQ (map0, map1);
@@ -1229,9 +1229,9 @@ test_sm_state_map ()
const state_machine::state_t TEST_STATE_2 = &test_state_2;
const state_machine::state test_state_3 ("test state 3", 3);
const state_machine::state_t TEST_STATE_3 = &test_state_3;
- sm_state_map map0 (*sm, 0);
- sm_state_map map1 (*sm, 0);
- sm_state_map map2 (*sm, 0);
+ sm_state_map map0 (*sm);
+ sm_state_map map1 (*sm);
+ sm_state_map map2 (*sm);
ASSERT_EQ (map0.hash (), map1.hash ());
ASSERT_EQ (map0, map1);
diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h
index 094d2562656..353cce22844 100644
--- a/gcc/analyzer/program-state.h
+++ b/gcc/analyzer/program-state.h
@@ -102,7 +102,7 @@ public:
typedef hash_map <const svalue *, entry_t> map_t;
typedef map_t::iterator iterator_t;
- sm_state_map (const state_machine &sm, int m_sm_idx);
+ sm_state_map (const state_machine &sm);
sm_state_map *clone () const;
@@ -163,7 +163,6 @@ public:
private:
const state_machine &m_sm;
- int m_sm_idx;
map_t m_map;
state_machine::state_t m_global_state;
};
diff --git a/gcc/analyzer/region-model-reachability.cc b/gcc/analyzer/region-model-reachability.cc
index 3a6b312a8df..bf99cf1d81d 100644
--- a/gcc/analyzer/region-model-reachability.cc
+++ b/gcc/analyzer/region-model-reachability.cc
@@ -58,9 +58,8 @@ along with GCC; see the file COPYING3. If not see
namespace ana {
-reachable_regions::reachable_regions (region_model *model,
- region_model_manager *mgr)
-: m_model (model), m_store (model->get_store ()), m_mgr (mgr),
+reachable_regions::reachable_regions (region_model *model)
+: m_model (model), m_store (model->get_store ()),
m_reachable_base_regs (), m_mutable_base_regs ()
{
}
diff --git a/gcc/analyzer/region-model-reachability.h b/gcc/analyzer/region-model-reachability.h
index fe305b0ce78..4d30c1fdd1d 100644
--- a/gcc/analyzer/region-model-reachability.h
+++ b/gcc/analyzer/region-model-reachability.h
@@ -35,7 +35,7 @@ namespace ana {
class reachable_regions
{
public:
- reachable_regions (region_model *model, region_model_manager *mgr);
+ reachable_regions (region_model *model);
/* Callback called for each cluster when initializing this object. */
static void init_cluster_cb (const region *base_reg,
@@ -97,7 +97,6 @@ public:
private:
region_model *m_model;
store *m_store;
- region_model_manager *m_mgr;
/* The base regions already seen. */
hash_set<const region *> m_reachable_base_regs;
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 06c0c8668ac..e7f306280c8 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -836,7 +836,7 @@ region_model::handle_unrecognized_call (const gcall *call,
{
tree fndecl = get_fndecl_for_call (call, ctxt);
- reachable_regions reachable_regs (this, m_mgr);
+ reachable_regions reachable_regs (this);
/* Determine the reachable regions and their mutability. */
{
@@ -904,7 +904,7 @@ void
region_model::get_reachable_svalues (svalue_set *out,
const svalue *extra_sval)
{
- reachable_regions reachable_regs (this, m_mgr);
+ reachable_regions reachable_regs (this);
/* Add globals and regions that already escaped in previous
unknown calls. */
@@ -2855,8 +2855,7 @@ region_model::can_merge_with_p (const region_model &other_model,
/* Merge constraints. */
constraint_manager::merge (*m_constraints,
*other_model.m_constraints,
- out_model->m_constraints,
- m);
+ out_model->m_constraints);
return true;
}
--
2.28.0
More information about the Gcc-patches
mailing list