From d7242d89992bd2e9937b379a43405714a9d342b9 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 17 Jul 2019 18:19:52 -0400
Subject: [PATCH 098/108] FIXME: cleanups

---
 gcc/analyzer/region-model.cc | 86 +++++++++++++++++++++++++-------------------
 1 file changed, 49 insertions(+), 37 deletions(-)

diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index f445ee6..3aa5ab3 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -119,7 +119,7 @@ class impl_constraint_manager : public constraint_manager
 
 ////////////////////////////////////////////////////////////////////////////
 
-/* FIXME.  */
+/* Print this svalue_id to PP.  */
 
 void
 svalue_id::print (pretty_printer *pp) const
@@ -151,7 +151,7 @@ svalue_id::to_str () const
 
 ////////////////////////////////////////////////////////////////////////////
 
-/* FIXME.  */
+/* Print this region_id to PP.  */
 
 void
 region_id::print (pretty_printer *pp) const
@@ -313,7 +313,8 @@ id_set<region_id>::id_set (const region_model *model)
 
 /* class svalue.  */
 
-/* FIXME.  */
+/* svalue's equality operator.  Most of the work is done by the
+   compare_fields vfunc.  */
 
 bool
 svalue::operator== (const svalue &other) const
@@ -420,7 +421,7 @@ svalue::to_str () const
 }
 #endif
 
-/* FIXME.  */
+/* Base implementation of svalue::remap_region_ids vfunc.  */
 
 void
 svalue::remap_region_ids (const region_id_map &)
@@ -490,7 +491,7 @@ region_svalue::dump_dot_to_pp (const region_model &model,
   }
 }
 
-/* FIXME.  */
+/* Implementation of svalue::remap_region_ids vfunc for region_svalue.  */
 
 void
 region_svalue::remap_region_ids (const region_id_map &map)
@@ -1149,7 +1150,8 @@ region::remap_svalue_ids (const svalue_id_map &map)
   map.update (&m_sval_id);
 }
 
-/* FIXME.  */
+/* Base implementation of region::remap_region_ids vfunc; subclasses should
+   chain up to this, updating any region_id data.  */
 
 void
 region::remap_region_ids (const region_id_map &map)
@@ -1157,7 +1159,8 @@ region::remap_region_ids (const region_id_map &map)
   map.update (&m_parent_rid);
 }
 
-/* FIXME.  */
+/* Base implementation of region::add_to_hash vfunc; subclasses should
+   chain up to this.  */
 
 void
 region::add_to_hash (inchash::hash &hstate) const
@@ -1190,7 +1193,7 @@ POP_IGNORE_WFORMAT
 
 /* class map_region : public region.  */
 
-/* FIXME.  */
+/* map_region's copy ctor.  */
 
 map_region::map_region (const map_region &other)
 : region (other),
@@ -1221,7 +1224,7 @@ map_region::compare_fields (const map_region &other) const
   return true;
 }
 
-/* FIXME.  */
+/* Implementation of region::clone vfunc for map_region.  */
 
 region *
 map_region::clone () const
@@ -1332,7 +1335,7 @@ map_region::get_or_create (region_model *model,
   return child_rid;
 }
 
-/* FIXME.  */
+/* Implementation of region::add_to_hash vfunc for map_region.  */
 
 void
 map_region::add_to_hash (inchash::hash &hstate) const
@@ -1341,7 +1344,7 @@ map_region::add_to_hash (inchash::hash &hstate) const
   // TODO
 }
 
-/* FIXME.  */
+/* Implementation of region::remap_region_ids vfunc for map_region.  */
 
 void
 map_region::remap_region_ids (const region_id_map &map)
@@ -1658,7 +1661,7 @@ frame_region::compare_fields (const frame_region &other) const
   return true;
 }
 
-/* FIXME.  */
+/* Implementation of region::clone vfunc for frame_region.  */
 
 region *
 frame_region::clone () const
@@ -1677,7 +1680,7 @@ frame_region::print_fields (const region_model &model,
   pp_printf (pp, ", function: %qs, depth: %i", function_name (m_fun), m_depth);
 }
 
-/* FIXME.  */
+/* Implementation of region::add_to_hash vfunc for frame_region.  */
 
 void
 frame_region::add_to_hash (inchash::hash &hstate) const
@@ -1689,7 +1692,7 @@ frame_region::add_to_hash (inchash::hash &hstate) const
 
 /* class stack_region : public region.  */
 
-/* FIXME.  */
+/* stack_region's copy ctor.  */
 
 stack_region::stack_region (const stack_region &other)
 : region (other),
@@ -1718,7 +1721,7 @@ stack_region::compare_fields (const stack_region &other) const
   return true;
 }
 
-/* FIXME.  */
+/* Implementation of region::clone vfunc for stack_region.  */
 
 region *
 stack_region::clone () const
@@ -1814,7 +1817,7 @@ stack_region::pop_frame (region_model *model, purge_stats *stats,
   return result_sid;
 }
 
-/* FIXME.  */
+/* Implementation of region::add_to_hash vfunc for stack_region.  */
 
 void
 stack_region::add_to_hash (inchash::hash &hstate) const
@@ -1827,7 +1830,7 @@ stack_region::add_to_hash (inchash::hash &hstate) const
     inchash::add (*frame_rid, hstate);
 }
 
-/* FIXME.  */
+/* Implementation of region::remap_region_ids vfunc for stack_region.  */
 
 void
 stack_region::remap_region_ids (const region_id_map &map)
@@ -1911,7 +1914,7 @@ stack_region::get_value_by_name (tree identifier,
 
 /* class heap_region : public region.  */
 
-/* FIXME.  */
+/* heap_region's copy ctor.  */
 
 heap_region::heap_region (const heap_region &other)
 : region (other)
@@ -1927,7 +1930,7 @@ heap_region::compare_fields (const heap_region &) const
   return true;
 }
 
-/* FIXME.  */
+/* Implementation of region::clone vfunc for heap_region.  */
 
 region *
 heap_region::clone () const
@@ -1969,7 +1972,7 @@ heap_region::walk_for_canonicalization (canonicalization *) const
 
 /* class root_region : public region.  */
 
-/* FIXME.  */
+/* root_region's default ctor.  */
 
 root_region::root_region ()
 : region (region_id::null (),
@@ -1978,7 +1981,7 @@ root_region::root_region ()
 {
 }
 
-/* FIXME.  */
+/* root_region's copy ctor.  */
 
 root_region::root_region (const root_region &other)
 : region (other),
@@ -2002,7 +2005,7 @@ root_region::compare_fields (const root_region &other) const
   return true;
 }
 
-/* FIXME.  */
+/* Implementation of region::clone vfunc for root_region.  */
 
 region *
 root_region::clone () const
@@ -2204,7 +2207,7 @@ root_region::get_heap_region (const region_model *model) const
   return model->get_region <heap_region> (m_heap_rid);
 }
 
-/* FIXME.  */
+/* Implementation of region::remap_region_ids vfunc for root_region.  */
 
 void
 root_region::remap_region_ids (const region_id_map &map)
@@ -2274,7 +2277,7 @@ root_region::can_merge_p (const root_region *root_region_a,
   return true;
 }
 
-/* FIXME.  */
+/* Implementation of region::add_to_hash vfunc for root_region.  */
 
 void
 root_region::add_to_hash (inchash::hash &hstate) const
@@ -2321,7 +2324,7 @@ root_region::get_value_by_name (tree identifier,
 
 /* class symbolic_region : public map_region.  */
 
-/* FIXME.  */
+/* symbolic_region's copy ctor.  */
 
 symbolic_region::symbolic_region (const symbolic_region &other)
 : map_region (other)
@@ -2337,7 +2340,7 @@ symbolic_region::compare_fields (const symbolic_region &) const
   return true;
 }
 
-/* FIXME.  */
+/* Implementation of region::clone vfunc for symbolic_region.  */
 
 region *
 symbolic_region::clone () const
@@ -2349,7 +2352,7 @@ symbolic_region::clone () const
 
 /* class region_model.  */
 
-/* FIXME.  */
+/* region_model's default ctor.  */
 
 region_model::region_model ()
 {
@@ -2358,7 +2361,7 @@ region_model::region_model ()
   // TODO
 }
 
-/* FIXME.  */
+/* region_model's copy ctor.  */
 
 region_model::region_model (const region_model &other)
 : m_root_rid (other.m_root_rid)
@@ -2384,7 +2387,7 @@ region_model::~region_model ()
   delete m_constraints;
 }
 
-/* FIXME.  */
+/* region_model's assignment operator.  */
 
 region_model &
 region_model::operator= (const region_model &other)
@@ -2777,7 +2780,8 @@ region_model::canonicalize (region_model_context *ctxt)
   validate ();
 }
 
-/* FIXME.  */
+/* Update this model for the ASSIGN stmt, using CTXT to report any
+   diagnostics.  */
 
 void
 region_model::on_assignment (const gassign *assign, region_model_context *ctxt)
@@ -2976,7 +2980,8 @@ region_model::on_assignment (const gassign *assign, region_model_context *ctxt)
     }
 }
 
-/* FIXME.  */
+/* Update this model for the CALL stmt, using CTXT to report any
+   diagnostics.  */
 
 void
 region_model::on_call (const gcall *call, region_model_context *ctxt)
@@ -3095,7 +3100,8 @@ region_model::on_call (const gcall *call, region_model_context *ctxt)
      presumably we need to do before overwriting the old value).  */
 }
 
-/* FIXME.  */
+/* Update this model for the RETURN_STMT, using CTXT to report any
+   diagnostics.  */
 
 void
 region_model::on_return (const greturn *return_stmt, region_model_context *ctxt)
@@ -3371,6 +3377,8 @@ region_model::get_svalue_for_fndecl (tree fndecl)
   return get_or_create_constant_svalue (fndecl);
 }
 
+/* FIXME.  */
+
 class deref_diagnostic : public pending_diagnostic_subclass<deref_diagnostic>
 {
 public:
@@ -3390,6 +3398,8 @@ protected:
   tree m_ptr;
 };
 
+/* FIXME.  */
+
 class deref_of_poisoned_pointer : public deref_diagnostic
 {
 public:
@@ -4001,7 +4011,7 @@ region_model::apply_constraints_for_gswitch (const superedge &edge,
     }
 }
 
-/* FIXME.  */
+/* Get the root_region within this model (guaranteed to be non-null).  */
 
 root_region *
 region_model::get_root_region () const
@@ -4009,7 +4019,7 @@ region_model::get_root_region () const
   return get_region<root_region> (m_root_rid);
 }
 
-/* FIXME.  */
+/* Get the region_id of this model's stack region (if any).  */
 
 region_id
 region_model::get_stack_region_id () const
@@ -4064,7 +4074,7 @@ region_model::get_stack_depth () const
     return 0;
 }
 
-/* FIXME.  */
+/* Get the region_id of this model's globals region (if any).  */
 
 region_id
 region_model::get_globals_region_id () const
@@ -4072,7 +4082,8 @@ region_model::get_globals_region_id () const
   return get_root_region ()->get_globals_region_id ();
 }
 
-/* FIXME.  */
+/* Add SVAL to this model, taking ownership, and returning its new
+   svalue_id.  */
 
 svalue_id
 region_model::add_svalue (svalue *sval)
@@ -4100,7 +4111,8 @@ region_model::replace_svalue (svalue_id sid, svalue *new_sval)
   m_svalues[idx] = new_sval;
 }
 
-/* Add region R to this model, returning its region_id.  */
+/* Add region R to this model, taking ownership, and returning its new
+   region_id.  */
 
 region_id
 region_model::add_region (region *r)
-- 
1.8.5.3

