From a57be4812932176ff705a98474f455258a14a45c Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Fri, 20 Sep 2019 17:53:19 -0400
Subject: [PATCH 116/124] FIXME: impl-2.cc:: put as much as possible in an
 impl_2 namespace

---
 gcc/analyzer/impl-2.cc | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/gcc/analyzer/impl-2.cc b/gcc/analyzer/impl-2.cc
index 6de81d7..ac1e402 100644
--- a/gcc/analyzer/impl-2.cc
+++ b/gcc/analyzer/impl-2.cc
@@ -41,8 +41,11 @@
 #include "fold-const.h"
 #include "analyzer/tristate.h"
 #include "analyzer/pending-diagnostic.h"
+#include "analyzer/path-state.h" // FIXME
 #include "selftest.h"
 
+namespace impl_2 {
+
 ////////////////////////////////////////////////////////////////////////////
 
 class sm_instance;
@@ -165,6 +168,11 @@ struct pod_hash_traits : typed_noop_remove<Type>
 
 ////////////////////////////////////////////////////////////////////////////
 
+} // namespace impl_2
+
+using impl_2::var_state_t;
+using impl_2::pod_hash_traits;
+
 template <> struct default_hash_traits<var_state_t>
 : public pod_hash_traits<var_state_t>
 {
@@ -213,6 +221,8 @@ pod_hash_traits<var_state_t>::is_empty (value_type v)
 
 ////////////////////////////////////////////////////////////////////////////
 
+using impl_2::summary_edge;
+
 template <> struct default_hash_traits<summary_edge>
 : public pod_hash_traits<summary_edge>
 {
@@ -260,6 +270,7 @@ pod_hash_traits<summary_edge>::is_empty (value_type v)
   return v.m_start.m_varstate.m_var == NULL_TREE;
 }
 
+namespace impl_2 {
 
 std::string
 to_str (const var_state_t &vs, const state_machine &sm)
@@ -319,7 +330,7 @@ public:
 
   std::string to_str (const state_machine &sm) const
   {
-    return ::to_str (m_hashset, sm);
+    return impl_2::to_str (m_hashset, sm);
   }
 
   void add (const summary_edge &e)
@@ -410,7 +421,7 @@ public:
 
   std::string to_str (const state_machine &sm) const
   {
-    return ::to_str (m_set, sm);
+    return impl_2::to_str (m_set, sm);
   }
 
   iterator begin () const { return m_set.begin (); }
@@ -1077,8 +1088,6 @@ public:
   auto_vec <link> m_links; // FIXME: copy-ctor etc
 };
 
-#include "analyzer/path-state.h" // FIXME
-
 class candidate_diagnostic
 {
 public:
@@ -3798,6 +3807,8 @@ run_one_checker (const supergraph &sg, const state_machine &sm, logger *logger)
   e.log_stats ();
 }
 
+} // namespace impl_2
+
 /* FIXME.  */
 
 void
@@ -3839,7 +3850,7 @@ run_checkers_impl_2 ()
     {
       auto_client_timevar tv ("malloc_state_machine");
       state_machine *sm = make_malloc_state_machine (the_logger.get_logger ());
-      run_one_checker (sg, *sm, the_logger.get_logger ());
+      impl_2::run_one_checker (sg, *sm, the_logger.get_logger ());
       delete sm;
     }
 
@@ -3847,7 +3858,7 @@ run_checkers_impl_2 ()
       auto_client_timevar tv ("fileptr_state_machine");
       state_machine *sm
 	= make_fileptr_state_machine (the_logger.get_logger ());
-      run_one_checker (sg, *sm, the_logger.get_logger ());
+      impl_2::run_one_checker (sg, *sm, the_logger.get_logger ());
       delete sm;
     }
 
@@ -3855,7 +3866,7 @@ run_checkers_impl_2 ()
       auto_client_timevar tv ("taint_state_machine");
       state_machine *sm
 	= make_taint_state_machine (the_logger.get_logger ());
-      run_one_checker (sg, *sm, the_logger.get_logger ());
+      impl_2::run_one_checker (sg, *sm, the_logger.get_logger ());
       delete sm;
     }
 
@@ -3863,7 +3874,7 @@ run_checkers_impl_2 ()
       auto_client_timevar tv ("sensitive_state_machine");
       state_machine *sm
 	= make_sensitive_state_machine (the_logger.get_logger ());
-      run_one_checker (sg, *sm, the_logger.get_logger ());
+      impl_2::run_one_checker (sg, *sm, the_logger.get_logger ());
       delete sm;
     }
 
@@ -3874,7 +3885,7 @@ run_checkers_impl_2 ()
 	auto_client_timevar tv ("pattern_test_state_machine");
 	state_machine *sm
 	  = make_pattern_test_state_machine (the_logger.get_logger ());
-	run_one_checker (sg, *sm, the_logger.get_logger ());
+	impl_2::run_one_checker (sg, *sm, the_logger.get_logger ());
 	delete sm;
       }
 
@@ -3904,7 +3915,7 @@ test_set_of_vars ()
   var_state_t vs_x (x, 0);
   var_state_t vs_y (y, 0);
 
-  set_of_vars sv;
+  impl_2::set_of_vars sv;
   sv.m_set.add (vs_x);
   sv.m_set.add (vs_y);
 
-- 
1.8.5.3

