From 788f0d27e94661944807eafc0d8a812b6379e9cd Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 13 May 2020 14:08:13 -0400
Subject: [PATCH 122/293] FIXME: remove ifdef-out
 svalue2::hash/add_to_hash/print/print_details and their vfuncs

---
 gcc/analyzer/region-model2.cc | 150 ----------------------------------
 gcc/analyzer/region-model2.h  |  96 ----------------------
 2 files changed, 246 deletions(-)

diff --git a/gcc/analyzer/region-model2.cc b/gcc/analyzer/region-model2.cc
index cdfac4a52a7..13efc72199e 100644
--- a/gcc/analyzer/region-model2.cc
+++ b/gcc/analyzer/region-model2.cc
@@ -158,45 +158,6 @@ class impl_constraint_manager : public constraint_manager
 
 /* class svalue2.  */
 
-/* Generate a hash value for this svalue2.  Most of the work is done by the
-   add_to_hash vfunc.  */
-
-#if 0
-hashval_t
-svalue2::hash () const
-{
-  inchash::hash hstate;
-  if (m_type)
-    hstate.add_int (TYPE_UID (m_type));
-  add_to_hash (hstate);
-  return hstate.end ();
-}
-#endif
-
-/* Print this svalue2 to PP.  */
-#if 0
-void
-svalue2::print (const region_model2 &model,
-		pretty_printer *pp) const
-{
-  this_sid.print (pp);
-  pp_string (pp, ": {");
-
-  if (m_type)
-    {
-      gcc_assert (TYPE_P (m_type));
-      pp_string (pp, "type: ");
-      print_quoted_type (pp, m_type);
-      pp_string (pp, ", ");
-    }
-
-  /* vfunc.  */
-  print_details (model, this_sid, pp);
-
-  pp_string (pp, "}");
-}
-#endif
-
 /* Dump this svalue2 in the form of a .dot record to PP.  */
 
 #if 0
@@ -275,33 +236,6 @@ region_svalue2::compare_fields (const region_svalue2 &other) const
 }
 #endif
 
-/* Implementation of svalue2::add_to_hash vfunc for region_svalue2.  */
-
-#if 0
-void
-region_svalue2::add_to_hash (inchash::hash &hstate) const
-{
-  inchash::add (m_reg, hstate);
-}
-#endif
-/* Implementation of svalue2::print_details vfunc for region_svalue2.  */
-
-#if 0
-void
-region_svalue2::print_details (const region_model2 &model ATTRIBUTE_UNUSED,
-			      svalue2_id this_sval ATTRIBUTE_UNUSED,
-			      pretty_printer *pp) const
-{
-  if (m_reg.null_p ())
-    pp_string (pp, "NULL");
-  else
-    {
-      pp_string (pp, "&");
-      m_reg.print (pp);
-    }
-}
-#endif
-
 /* Implementation of svalue2::dump_dot_to_pp for region_svalue2.  */
 
 #if 0
@@ -500,15 +434,6 @@ constant_svalue2::compare_fields (const constant_svalue2 &other) const
 }
 #endif
 
-/* Implementation of svalue2::add_to_hash vfunc for constant_svalue2.  */
-#if 0
-void
-constant_svalue2::add_to_hash (inchash::hash &hstate) const
-{
-  inchash::add_expr (m_cst_expr, hstate);
-}
-#endif
-
 /* Merge the CST_SVAL_A and CST_SVAL_B using MERGER, writing the id of
    the resulting svalue2 into *MERGED_SVAL.  */
 #if 0
@@ -566,16 +491,6 @@ constant_svalue2::eval_condition (const constant_svalue2 *lhs,
   return tristate::TS_UNKNOWN;
 }
 
-/* Implementation of svalue2::print_details vfunc for constant_svalue2.  */
-#if 0
-void
-constant_svalue2::print_details (const region_model2 &model ATTRIBUTE_UNUSED,
-				 pretty_printer *pp) const
-{
-  pp_printf (pp, "%qE", m_cst_expr);
-}
-#endif
-
 /* Implementation of svalue2::get_child_sval vfunc for constant_svalue2.  */
 #if 0
 svalue2_id
@@ -612,25 +527,6 @@ unknown_svalue2::compare_fields (const unknown_svalue2 &) const
 }
 #endif
 
-/* Implementation of svalue2::add_to_hash vfunc for unknown_svalue2.  */
-#if 0
-void
-unknown_svalue2::add_to_hash (inchash::hash &) const
-{
-  /* Empty.  */
-}
-#endif
-
-/* Implementation of svalue2::print_details vfunc for unknown_svalue2.  */
-#if 0
-void
-unknown_svalue2::print_details (const region_model2 &model ATTRIBUTE_UNUSED,
-			       pretty_printer *pp) const
-{
-  pp_string (pp, "unknown");
-}
-#endif
-
 /* class poisoned_svalue2 : public svalue2.  */
 
 /* Compare the fields of this poisoned_svalue2 with OTHER, returning true
@@ -644,25 +540,6 @@ poisoned_svalue2::compare_fields (const poisoned_svalue2 &other) const
 }
 #endif
 
-/* Implementation of svalue2::add_to_hash vfunc for poisoned_svalue2.  */
-#if 0
-void
-poisoned_svalue2::add_to_hash (inchash::hash &hstate) const
-{
-  hstate.add_int (m_kind);
-}
-#endif
-
-/* Implementation of svalue2::print_details vfunc for poisoned_svalue2.  */
-#if 0
-void
-poisoned_svalue2::print_details (const region_model2 &model ATTRIBUTE_UNUSED,
-				pretty_printer *pp) const
-{
-  pp_printf (pp, "poisoned: %s", poison_kind_to_str (m_kind));
-}
-#endif
-
 /* FIXME.  */
 
 void
@@ -711,33 +588,6 @@ initial_svalue2::compare_fields (const initial_svalue2 &other) const
 }
 #endif
 
-/* Implementation of svalue2::add_to_hash vfunc for initial_svalue2.  */
-
-#if 0
-void
-initial_svalue2::add_to_hash (inchash::hash &hstate) const
-{
-  inchash::add (m_reg, hstate);
-}
-#endif
-/* Implementation of svalue2::print_details vfunc for initial_svalue2.  */
-
-#if 0
-void
-initial_svalue2::print_details (const region_model2 &model ATTRIBUTE_UNUSED,
-			      svalue2_id this_sval ATTRIBUTE_UNUSED,
-			      pretty_printer *pp) const
-{
-  if (m_reg.null_p ())
-    pp_string (pp, "NULL");
-  else
-    {
-      pp_string (pp, "&");
-      m_reg.print (pp);
-    }
-}
-#endif
-
 /* class unaryop_svalue2 : public svalue2.  */
 
 void
diff --git a/gcc/analyzer/region-model2.h b/gcc/analyzer/region-model2.h
index a601452c439..11e1bb95a84 100644
--- a/gcc/analyzer/region-model2.h
+++ b/gcc/analyzer/region-model2.h
@@ -163,10 +163,6 @@ public:
 
   virtual enum kind get_kind () const = 0;
 
-#if 0
-  hashval_t hash () const;
-#endif
-
   void print (const region_model2 &model,
 	      pretty_printer *pp) const;
 
@@ -198,15 +194,7 @@ public:
  protected:
   svalue2 (tree type) : m_type (type) {}
 
-#if 0
-  virtual void add_to_hash (inchash::hash &hstate) const = 0;
-#endif
-
  private:
-#if 0
-  virtual void print_details (const region_model2 &model,
-			      pretty_printer *pp) const = 0;
-#endif
   tree m_type;
 };
 
@@ -253,16 +241,7 @@ public:
 				  enum tree_code op,
 				  const region_svalue2 *rhs_ptr);
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
  private:
-#if 0
-  void print_details (const region_model2 &model, pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
-
   const region2 *m_reg;
 };
 
@@ -298,10 +277,6 @@ public:
   enum kind get_kind () const FINAL OVERRIDE { return SK_CONSTANT; }
   void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
   const constant_svalue2 *
   dyn_cast_constant_svalue2 () const FINAL OVERRIDE { return this; }
 
@@ -319,12 +294,6 @@ public:
 				  const constant_svalue2 *rhs);
 
  private:
-#if 0
-  void print_details (const region_model2 &model,
-		      pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
-  
   tree m_cst_expr;
 };
 
@@ -359,19 +328,10 @@ public:
   enum kind get_kind () const FINAL OVERRIDE { return SK_UNKNOWN; }
   void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
   const unknown_svalue2 *
   dyn_cast_unknown_svalue2 () const FINAL OVERRIDE { return this; }
 
  private:
-#if 0
-  void print_details (const region_model2 &model,
-		      pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
 };
 
 #if 0
@@ -435,22 +395,12 @@ public:
   enum kind get_kind () const FINAL OVERRIDE { return SK_POISONED; }
   void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
   const poisoned_svalue2 *
   dyn_cast_poisoned_svalue2 () const FINAL OVERRIDE { return this; }
 
   enum poison_kind get_poison_kind () const { return m_kind; }
 
  private:
-#if 0
-  void print_details (const region_model2 &model,
-		      pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
-
   enum poison_kind m_kind;
 };
 
@@ -518,10 +468,6 @@ public:
   enum kind get_kind () const FINAL OVERRIDE { return SK_SETJMP; }
   void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
   const setjmp_svalue2 *
   dyn_cast_setjmp_svalue2 () const FINAL OVERRIDE { return this; }
 
@@ -530,12 +476,6 @@ public:
   const setjmp_record &get_setjmp_record () const { return m_setjmp_record; }
 
  private:
-#if 0
-  void print_details (const region_model2 &model,
-		      pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
-
   setjmp_record m_setjmp_record;
 };
 
@@ -591,16 +531,7 @@ public:
 			    model_merger *merger);
 #endif
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
  private:
-#if 0
-  void print_details (const region_model2 &model, pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
-
   const region2 *m_reg;
 };
 
@@ -670,19 +601,10 @@ public:
   void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
 
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
   enum tree_code get_op () const { return m_op; }
   const svalue2 *get_arg () const { return m_arg; }
 
  private:
-#if 0
-  void print_details (const region_model2 &model, pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
-
   enum tree_code m_op;
   const svalue2 *m_arg;
 };
@@ -768,16 +690,7 @@ public:
   dyn_cast_binop_svalue2 () const FINAL OVERRIDE { return this; }
 #endif
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
  private:
-#if 0
-  void print_details (const region_model2 &model, pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
-
   enum tree_code m_op;
   const svalue2 *m_arg0;
   const svalue2 *m_arg1;
@@ -857,16 +770,7 @@ public:
   binop_svalue2 *dyn_cast_binop_svalue2 () FINAL OVERRIDE { return this; }
 #endif
 
-#if 0
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-#endif
-
  private:
-#if 0
-  void print_details (const region_model2 &model, pretty_printer *pp) const
-    FINAL OVERRIDE;
-#endif
-
   const svalue2 *m_parent_svalue;
   const region2 *m_subregion;
 };
-- 
2.26.2

