analyzer: make extrinsic_state field private

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.
This commit is contained in:
David Malcolm 2020-01-30 16:38:35 -05:00
parent bba54d62af
commit ebe9174e94
4 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2020-01-30 David Malcolm <dmalcolm@redhat.com>
* 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.
2020-01-30 David Malcolm <dmalcolm@redhat.com>
PR analyzer/93356

View File

@ -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];

View File

@ -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 ());
}

View File

@ -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;
};