[committed] analyzer: make extrinsic_state field private

Message ID 20200131002722.18805-1-dmalcolm@redhat.com
State New
Headers show
Series
  • [committed] analyzer: make extrinsic_state field private
Related show

Commit Message

David Malcolm Jan. 31, 2020, 12:27 a.m.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Committed to master as ebe9174e940c94e99cd688a05309833ae64a998b.

gcc/analyzer/ChangeLog:
	* diagnostic-manager.cc (for_each_state_change): Use
	extrinsic_state::get_num_checkers rather than accessing m_checkers
	directly.
	* program-state.cc (program_state::program_state): Likewise.
	* program-state.h (extrinsic_state::m_checkers): Make private.
---
 gcc/analyzer/diagnostic-manager.cc | 6 +++---
 gcc/analyzer/program-state.cc      | 4 ++--
 gcc/analyzer/program-state.h       | 1 +
 3 files changed, 6 insertions(+), 5 deletions(-)

-- 
2.21.0

Patch

diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc
index eb1fa05533e..023fda9fa7c 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -684,10 +684,10 @@  for_each_state_change (const program_state &src_state,
 		       state_change_visitor *visitor)
 {
   gcc_assert (src_state.m_checker_states.length ()
-	      == ext_state.m_checkers.length ());
+	      == ext_state.get_num_checkers ());
   gcc_assert (dst_state.m_checker_states.length ()
-	      == ext_state.m_checkers.length ());
-  for (unsigned i = 0; i < ext_state.m_checkers.length (); i++)
+	      == ext_state.get_num_checkers ());
+  for (unsigned i = 0; i < ext_state.get_num_checkers (); i++)
     {
       const state_machine &sm = ext_state.get_sm (i);
       const sm_state_map &src_smap = *src_state.m_checker_states[i];
diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc
index f41f105ce6b..ead62a5d423 100644
--- a/gcc/analyzer/program-state.cc
+++ b/gcc/analyzer/program-state.cc
@@ -535,9 +535,9 @@  sm_state_map::validate (const state_machine &sm,
 
 program_state::program_state (const extrinsic_state &ext_state)
 : m_region_model (new region_model ()),
-  m_checker_states (ext_state.m_checkers.length ())
+  m_checker_states (ext_state.get_num_checkers ())
 {
-  int num_states = ext_state.m_checkers.length ();
+  int num_states = ext_state.get_num_checkers ();
   for (int i = 0; i < num_states; i++)
     m_checker_states.quick_push (new sm_state_map ());
 }
diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h
index 0a4e35f3d5d..a052c6e8026 100644
--- a/gcc/analyzer/program-state.h
+++ b/gcc/analyzer/program-state.h
@@ -45,6 +45,7 @@  public:
 
   unsigned get_num_checkers () const { return m_checkers.length (); }
 
+private:
   /* The state machines.  */
   auto_delete_vec <state_machine> &m_checkers;
 };