From 760f9b6c24446ed1f5f12f44131d153252559841 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 25 Sep 2019 14:52:45 -0400
Subject: [PATCH 120/124] FIXME: eliminate namespace impl_4

---
 gcc/analyzer/impl-4.cc | 65 ++++++++++++++++----------------------------------
 1 file changed, 20 insertions(+), 45 deletions(-)

diff --git a/gcc/analyzer/impl-4.cc b/gcc/analyzer/impl-4.cc
index a126307..deef874 100644
--- a/gcc/analyzer/impl-4.cc
+++ b/gcc/analyzer/impl-4.cc
@@ -225,8 +225,6 @@ FIXME:
 
    TODO: What about infinite recursion?  */
 
-namespace impl_4 {
-
 class exploded_graph;
 class exploded_node;
 class exploded_edge;
@@ -513,11 +511,6 @@ public:
   call_string m_call_string;
 };
 
-} // namespace impl_4
-
-using impl_4::pod_hash_traits;
-using impl_4::program_point;
-
 template <> struct default_hash_traits<program_point>
 : public pod_hash_traits<program_point>
 {
@@ -562,8 +555,6 @@ pod_hash_traits<program_point>::is_empty (value_type v)
   return v.m_kind == PK_EMPTY;
 }
 
-namespace impl_4 {
-
 ////////////////////////////////////////////////////////////////////////////
 
 /* The result of analyzing which SSA names can be purged from state at
@@ -694,10 +685,6 @@ private:
 
 ////////////////////////////////////////////////////////////////////////////
 
-} // namespace impl_4
-
-using impl_4::pod_hash_traits;
-
 template <> struct default_hash_traits<svalue_id>
 : public pod_hash_traits<svalue_id>
 {
@@ -742,8 +729,6 @@ pod_hash_traits<svalue_id>::is_empty (value_type v)
   return v.null_p ();
 }
 
-namespace impl_4 {
-
 /* Map from svalue_id to state machine state, also capturing the origin of
    each state.  */
 
@@ -3388,7 +3373,7 @@ class impl_region_model_context : public region_model_context, public log_user
   const program_state *m_old_state;
   program_state *m_new_state;
   const gimple *m_stmt;
-  impl_4::stmt_finder *m_stmt_finder;
+  stmt_finder *m_stmt_finder;
   const extrinsic_state &m_ext_state;
 };
 
@@ -3511,7 +3496,7 @@ public:
   program_state *m_new_state;
   const sm_state_map *m_old_smap;
   sm_state_map *m_new_smap;
-  impl_4::stmt_finder *m_stmt_finder;
+  stmt_finder *m_stmt_finder;
 };
 
 ////////////////////////////////////////////////////////////////////////////
@@ -7512,11 +7497,6 @@ struct function_call_string
   call_string m_cs;
 };
 
-} // namespace impl_4
-
-using impl_4::pod_hash_traits;
-using impl_4::function_call_string;
-
 template <> struct default_hash_traits<function_call_string>
 : public pod_hash_traits<function_call_string>
 {
@@ -7561,8 +7541,6 @@ pod_hash_traits<function_call_string>::is_empty (value_type v)
   return v.m_fun == reinterpret_cast<function *> (NULL);
 }
 
-namespace impl_4 {
-
 /* Top-level cluster for printing exploded graphs, handling the functionless
    nodes, and grouping the remaining nodes by callstring.  */
 
@@ -8689,8 +8667,8 @@ impl_run_checkers (logger *logger)
   const analysis_plan plan (sg, logger);
 
   /* The exploded graph.  */
-  impl_4::exploded_graph eg (sg, logger, ext_state, purge_map, plan,
-			     analyzer_verbosity);
+  exploded_graph eg (sg, logger, ext_state, purge_map, plan,
+		     analyzer_verbosity);
 
   /* Add entrypoints to the graph for externally-callable functions.  */
   eg.build_initial_worklist ();
@@ -8722,8 +8700,6 @@ impl_run_checkers (logger *logger)
   delete purge_map;
 }
 
-} // namespace impl_4
-
 /* FIXME.  */
 
 void
@@ -8741,7 +8717,7 @@ run_checkers_impl_4 ()
       }
     JIT_LOG_SCOPE (the_logger.get_logger ());
 
-    impl_4::impl_run_checkers (the_logger.get_logger ());
+    impl_run_checkers (the_logger.get_logger ());
 
     /* end of lifetime of the_logger (so that dump file is closed after the
        various dtors run).  */
@@ -8754,7 +8730,7 @@ run_checkers_impl_4 ()
 
 namespace selftest {
 
-/* Tests for impl_4::sm_state_map.  */
+/* Tests for sm_state_map.  */
 
 static void
 test_sm_state_map ()
@@ -8770,7 +8746,7 @@ test_sm_state_map ()
     svalue_id sid_y = model.get_rvalue (y, NULL);
     svalue_id sid_z = model.get_rvalue (z, NULL);
 
-    impl_4::sm_state_map map;
+    sm_state_map map;
     ASSERT_TRUE (map.is_empty_p ());
     ASSERT_EQ (map.get_state (sid_x), 0);
 
@@ -8795,7 +8771,7 @@ test_sm_state_map ()
     svalue_id sid_y = model.get_rvalue (y, NULL);
     svalue_id sid_z = model.get_rvalue (z, NULL);
 
-    impl_4::sm_state_map map;
+    sm_state_map map;
     ASSERT_TRUE (map.is_empty_p ());
     ASSERT_EQ (map.get_state (sid_x), 0);
     ASSERT_EQ (map.get_state (sid_y), 0);
@@ -8818,9 +8794,9 @@ test_sm_state_map ()
     svalue_id sid_y = model.get_rvalue (y, NULL);
     svalue_id sid_z = model.get_rvalue (z, NULL);
 
-    impl_4::sm_state_map map0;
-    impl_4::sm_state_map map1;
-    impl_4::sm_state_map map2;
+    sm_state_map map0;
+    sm_state_map map1;
+    sm_state_map map2;
 
     ASSERT_EQ (map0.hash (), map1.hash ());
     ASSERT_EQ (map0, map1);
@@ -8837,7 +8813,7 @@ test_sm_state_map ()
 
   /* Test sm_state_map::remap_svalue_ids.  */
   {
-    impl_4::sm_state_map map;
+    sm_state_map map;
     svalue_id sid_0 = svalue_id::from_int (0);
     svalue_id sid_1 = svalue_id::from_int (1);
     svalue_id sid_2 = svalue_id::from_int (2);
@@ -8872,14 +8848,14 @@ test_program_point_equality ()
 {
   const supernode *snode = NULL;
 
-  const impl_4::call_string cs;
+  const call_string cs;
 
   program_point a = program_point (snode, NULL, 0,
-				   impl_4::PK_BEFORE_SUPERNODE,
+				   PK_BEFORE_SUPERNODE,
 				   cs);
 
   program_point b = program_point (snode, NULL, 0,
-				   impl_4::PK_BEFORE_SUPERNODE,
+				   PK_BEFORE_SUPERNODE,
 				   cs);
   ASSERT_EQ (a, b);
   // TODO: verify with non-empty callstrings, with different edges
@@ -8891,22 +8867,22 @@ static void
 test_program_point_ordering ()
 {
   const supernode *snode = NULL;
-  const impl_4::call_string call_string;
+  const call_string call_string;
 
   /* Populate an array with various points within the same
      snode, in order.  */
   auto_delete_vec<program_point> points;
   points.safe_push (new program_point (snode, NULL, 0,
-				       impl_4::PK_BEFORE_SUPERNODE,
+				       PK_BEFORE_SUPERNODE,
 				       call_string));
   points.safe_push (new program_point (snode, NULL, 0,
-				       impl_4::PK_BEFORE_STMT,
+				       PK_BEFORE_STMT,
 				       call_string));
   points.safe_push (new program_point (snode, NULL, 1,
-				       impl_4::PK_BEFORE_STMT,
+				       PK_BEFORE_STMT,
 				       call_string));
   points.safe_push (new program_point (snode, NULL, 0,
-				       impl_4::PK_AFTER_SUPERNODE,
+				       PK_AFTER_SUPERNODE,
 				       call_string));
   /* Check all pairs.  */
   unsigned i;
@@ -8938,7 +8914,6 @@ test_program_state_merging ()
      malloc sm-state, pointing to a region on the heap.  */
   tree p = build_global_decl ("p", ptr_type_node);
 
-  using namespace impl_4;
   auto_delete_vec <state_machine> checkers;
   checkers.safe_push (make_malloc_state_machine (NULL));
   extrinsic_state ext_state (checkers);
-- 
1.8.5.3

