From dbd290fb26a88efa1e7ef9054f5611b4fa0cfcf0 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Sat, 16 May 2020 06:48:15 -0400
Subject: [PATCH 144/251] FIXME: remove redundant ctxt param from
 region_model2_manager member fns

---
 gcc/analyzer/region-model2.cc | 35 ++++++++++++++---------------------
 gcc/analyzer/region-model2.h  | 18 ++++++------------
 2 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/gcc/analyzer/region-model2.cc b/gcc/analyzer/region-model2.cc
index 9bb12fbd495..fd034dd970a 100644
--- a/gcc/analyzer/region-model2.cc
+++ b/gcc/analyzer/region-model2.cc
@@ -1796,8 +1796,7 @@ frame_region2::add_to_hash (inchash::hash &hstate) const
 
 const region2 *
 frame_region2::get_region_for_local (region_model2_manager *mgr,
-				     tree expr,
-				     region_model2_context */*ctxt*/) const
+				     tree expr) const
 {
   // TODO: could also check that VAR_DECLs are locals
   gcc_assert (TREE_CODE (expr) == PARM_DECL
@@ -2991,8 +2990,7 @@ region_model2_manager::get_or_create_sub_svalue2 (tree type,
 /* FIXME.  */
 
 const function_region2 *
-region_model2_manager::get_region_for_fndecl (tree fndecl,
-					      region_model2_context */*ctxt*/)
+region_model2_manager::get_region_for_fndecl (tree fndecl)
 {
   gcc_assert (TREE_CODE (fndecl) == FUNCTION_DECL);
 
@@ -3008,8 +3006,7 @@ region_model2_manager::get_region_for_fndecl (tree fndecl,
 /* FIXME.  */
 
 const label_region2 *
-region_model2_manager::get_region_for_label (tree label,
-					     region_model2_context *ctxt)
+region_model2_manager::get_region_for_label (tree label)
 {
   gcc_assert (TREE_CODE (label) == LABEL_DECL);
 
@@ -3020,7 +3017,7 @@ region_model2_manager::get_region_for_label (tree label,
   tree fndecl = DECL_CONTEXT (label);
   gcc_assert (fndecl && TREE_CODE (fndecl) == FUNCTION_DECL);
 
-  const function_region2 *func_reg = get_region_for_fndecl (fndecl, ctxt);
+  const function_region2 *func_reg = get_region_for_fndecl (fndecl);
   label_region2 *reg
     = new label_region2 (alloc_region_id (), func_reg, label);
   m_labels_map.put (label, reg);
@@ -3030,8 +3027,7 @@ region_model2_manager::get_region_for_label (tree label,
 /* FIXME.  */
 
 const decl_region2 *
-region_model2_manager::get_region_for_global (tree expr,
-					      region_model2_context */*ctxt*/)
+region_model2_manager::get_region_for_global (tree expr)
 {
   gcc_assert (TREE_CODE (expr) == VAR_DECL);
 
@@ -3059,8 +3055,7 @@ region_model2_manager::get_field_region (const region2 *parent, tree field)
 const region2 *
 region_model2_manager::get_element_region (const region2 *parent,
 					   tree element_type,
-					   const svalue2 *index,
-					   region_model2_context */*ctxt*/)
+					   const svalue2 *index)
 {
   // FIXME: should only alloc_region_id if consolidation fails
   region2 *element_reg
@@ -3073,8 +3068,7 @@ region_model2_manager::get_element_region (const region2 *parent,
 const region2 *
 region_model2_manager::get_offset_region (const region2 *parent,
 					  tree type,
-					  const svalue2 *byte_offset,
-					  region_model2_context */*ctxt*/)
+					  const svalue2 *byte_offset)
 {
   /* If BYTE_OFFSET is zero, return PARENT.  */
   if (tree cst_offset = byte_offset->maybe_get_constant ())
@@ -4955,7 +4949,7 @@ region_model2::get_lvalue_1 (path_var pv,
 	const svalue2 *index_sval = get_rvalue (index, ctxt);
 	return m_mgr->get_element_region (array_reg,
 					  TREE_TYPE (TREE_TYPE (array)),
-					  index_sval, ctxt);
+					  index_sval);
 #if 0
 	const region2 *base_array_reg = get_region2 (array_reg);
 	array_region2 *array_reg  = base_array_reg->dyn_cast_array_region2 ();
@@ -4993,20 +4987,20 @@ region_model2::get_lvalue_1 (path_var pv,
 	const region2 *star_ptr = deref_rvalue (ptr_sval, ctxt);
 	return m_mgr->get_offset_region (star_ptr,
 					 TREE_TYPE (expr),
-					 offset_sval, ctxt);
+					 offset_sval);
       }
       break;
 
     case FUNCTION_DECL:
-      return m_mgr->get_region_for_fndecl (expr, ctxt);
+      return m_mgr->get_region_for_fndecl (expr);
 
     case LABEL_DECL:
-      return m_mgr->get_region_for_label (expr, ctxt);
+      return m_mgr->get_region_for_label (expr);
 
     case VAR_DECL:
       /* Handle globals.  */
       if (is_global_var (expr))
-	return m_mgr->get_region_for_global (expr, ctxt);
+	return m_mgr->get_region_for_global (expr);
 
       /* Fall through.  */
 
@@ -5022,7 +5016,7 @@ region_model2::get_lvalue_1 (path_var pv,
 	int stack_index = pv.m_stack_depth;
 	const frame_region2 *frame = get_frame_at_index (stack_index);
 	gcc_assert (frame);
-	return frame->get_region_for_local (m_mgr, expr, ctxt);
+	return frame->get_region_for_local (m_mgr, expr);
       }
 
     case COMPONENT_REF:
@@ -5481,8 +5475,7 @@ region_model2::deref_rvalue (const svalue2 *ptr_sval,
 		= deref_rvalue (binop_sval->get_arg0 (), ctxt);
 	      const svalue2 *offset = binop_sval->get_arg1 ();
 	      tree type= TREE_TYPE (ptr_sval->get_type ());
-	      return m_mgr->get_offset_region (parent_region, type, offset,
-					       ctxt);
+	      return m_mgr->get_offset_region (parent_region, type, offset);
 	    }
 	  default:
 	    goto create_symbolic_region2;
diff --git a/gcc/analyzer/region-model2.h b/gcc/analyzer/region-model2.h
index e8c83548d87..fdf6d4ab765 100644
--- a/gcc/analyzer/region-model2.h
+++ b/gcc/analyzer/region-model2.h
@@ -999,8 +999,7 @@ public:
   bool compare_fields (const frame_region2 &other) const;
 
   const region2 *get_region_for_local (region_model2_manager *mgr,
-				       tree expr,
-				       region_model2_context *ctxt) const;
+				       tree expr) const;
 
  private:
   const frame_region2 *m_calling_frame;
@@ -1605,21 +1604,16 @@ public:
 					    const region2 *subregion);
 
   /* region2 consolidation.  */
-  const function_region2 *get_region_for_fndecl (tree fndecl,
-						 region_model2_context *ctxt);
-  const label_region2 *get_region_for_label (tree label,
-					     region_model2_context *ctxt);
-  const decl_region2 *get_region_for_global (tree expr,
-					     region_model2_context *ctxt);
+  const function_region2 *get_region_for_fndecl (tree fndecl);
+  const label_region2 *get_region_for_label (tree label);
+  const decl_region2 *get_region_for_global (tree expr);
   const region2 *get_field_region (const region2 *parent, tree field);
   const region2 *get_element_region (const region2 *parent,
 				     tree element_type,
-				     const svalue2 *index,
-				     region_model2_context *ctxt);
+				     const svalue2 *index);
   const region2 *get_offset_region (const region2 *parent,
 				    tree type,
-				    const svalue2 *byte_offset,
-				    region_model2_context *ctxt);
+				    const svalue2 *byte_offset);
   const region2 *get_cast_region (const region2 *original_region,
 				  tree type);
   const frame_region2 *get_frame_region (const frame_region2 *calling_frame,
-- 
2.26.2

