No functional change intended.

gcc/ChangeLog:
        * Makefile.in (OBJS-libcommon): Replace edit-context.o with
        diagnostics/edit-context.o.
        * diagnostic-format-html.cc: Update #include for move
        of edit-context.h to diagnostics subdir.
        * diagnostic.cc: Likewise.  Update for move of edit_context to
        diagnostics::edit_context.
        * diagnostic.h: Likewise.
        * edit-context.cc: Move to...
        * diagnostics/edit-context.cc: ...here.  Update #include for move
        of edit-context.h to diagnostics subdir.  Move all code
        within namespace diagnostics.
        * edit-context.h: Move to...
        * diagnostics/edit-context.h: ...here, updating header guard.
        Move all code within namespace diagnostics.
        * libgdiagnostics.cc: Update #include for move of edit-context.h
        to diagnostics subdir.  Update for move of edit_context
        to diagnostics::edit_context.
        * toplev.cc: Update #include for move of edit-context.h
        to diagnostics subdir.

gcc/testsuite/ChangeLog:
        * gcc.dg/plugin/expensive_selftests_plugin.cc: Update #include for
        move of edit-context.h to diagnostics subdir.  Update
        for move of edit_context to diagnostics::edit_context.

Signed-off-by: David Malcolm <dmalc...@redhat.com>
---
 gcc/Makefile.in                                       |  2 +-
 gcc/diagnostic-format-html.cc                         |  2 +-
 gcc/diagnostic.cc                                     |  4 ++--
 gcc/diagnostic.h                                      |  8 ++++----
 gcc/{ => diagnostics}/edit-context.cc                 |  8 +++++++-
 gcc/{ => diagnostics}/edit-context.h                  | 11 ++++++++---
 gcc/libgdiagnostics.cc                                |  7 ++++---
 .../gcc.dg/plugin/expensive_selftests_plugin.cc       |  4 ++--
 gcc/toplev.cc                                         |  2 +-
 9 files changed, 30 insertions(+), 18 deletions(-)
 rename gcc/{ => diagnostics}/edit-context.cc (99%)
 rename gcc/{ => diagnostics}/edit-context.h (92%)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index fc5ffc72df72..7610debabcd7 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1863,10 +1863,10 @@ OBJS-libcommon = diagnostic-spec.o diagnostic.o 
diagnostic-color.o \
        diagnostic-path-output.o \
        diagnostic-show-locus.o \
        diagnostics/digraphs.o \
+       diagnostics/edit-context.o \
        diagnostics/state-graphs.o \
        diagnostics/state-graphs-to-dot.o \
        diagnostics/selftest-logical-locations.o \
-       edit-context.o \
        graphviz.o pex.o \
        pretty-print.o intl.o \
        json.o json-parsing.o \
diff --git a/gcc/diagnostic-format-html.cc b/gcc/diagnostic-format-html.cc
index 33dca5c0147c..a8e36d6f4f14 100644
--- a/gcc/diagnostic-format-html.cc
+++ b/gcc/diagnostic-format-html.cc
@@ -38,7 +38,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "selftest-diagnostic.h"
 #include "pretty-print-format-impl.h"
 #include "pretty-print-urlifier.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
 #include "intl.h"
 #include "xml.h"
 #include "xml-printer.h"
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 09329f0712f6..b2b8f0a80511 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostic-format.h"
 #include "diagnostic-format-sarif.h"
 #include "diagnostic-format-text.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
 #include "selftest.h"
 #include "selftest-diagnostic.h"
 #include "opts.h"
@@ -663,7 +663,7 @@ diagnostic_context::create_edit_context ()
 {
   delete m_edit_context_ptr;
   gcc_assert (m_file_cache);
-  m_edit_context_ptr = new edit_context (*m_file_cache);
+  m_edit_context_ptr = new diagnostics::edit_context (*m_file_cache);
 }
 
 /* Initialize DIAGNOSTIC, where the message MSG has already been
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 4ddc4b062d2a..e51de435b20b 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -39,6 +39,7 @@ namespace diagnostics {
   } // namespace diagnostics::logical_locations
 
   class diagram;
+  class edit_context;
 
 } // namespace diagnostics
 
@@ -235,7 +236,6 @@ public:
   virtual char *make_option_url (diagnostic_option_id option_id) const = 0;
 };
 
-class edit_context;
 class diagnostic_client_data_hooks;
 class diagnostic_source_effect_info;
 class diagnostic_output_format;
@@ -549,7 +549,7 @@ struct diagnostic_counters
      source code
    - a cache for use when quoting the user's source code (class file_cache)
    - a text_art::theme
-   - an edit_context for generating patches from fix-it hints
+   - a diagnostics::edit_context for generating patches from fix-it hints
    - diagnostic_client_data_hooks for metadata.
 
    Try to avoid adding new responsibilities to this class itself, to avoid
@@ -726,7 +726,7 @@ public:
     return *m_file_cache;
   }
 
-  edit_context *get_edit_context () const
+  diagnostics::edit_context *get_edit_context () const
   {
     return m_edit_context_ptr;
   }
@@ -1060,7 +1060,7 @@ private:
      applied, for generating patches.
      Owned by the context; this would be a std::unique_ptr if
      diagnostic_context had a proper ctor.  */
-  edit_context *m_edit_context_ptr;
+  diagnostics::edit_context *m_edit_context_ptr;
 
   /* Fields relating to diagnostic groups.  */
   struct {
diff --git a/gcc/edit-context.cc b/gcc/diagnostics/edit-context.cc
similarity index 99%
rename from gcc/edit-context.cc
rename to gcc/diagnostics/edit-context.cc
index c767394433d6..e8c328d3a3db 100644
--- a/gcc/edit-context.cc
+++ b/gcc/diagnostics/edit-context.cc
@@ -21,11 +21,13 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "line-map.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
 #include "pretty-print.h"
 #include "diagnostic-color.h"
 #include "selftest.h"
 
+namespace diagnostics {
+
 /* This file implements a way to track the effect of fix-its,
    via a class edit_context; the other classes are support classes for
    edit_context.
@@ -895,12 +897,16 @@ edited_line::ensure_terminated ()
   m_content[m_len] = '\0';
 }
 
+} // namespace diagnostics
+
 #if CHECKING_P
 
 /* Selftests of code-editing.  */
 
 namespace selftest {
 
+using edit_context = diagnostics::edit_context;
+
 /* A wrapper class for ensuring that the underlying pointer is freed.  */
 
 template <typename POINTER_T>
diff --git a/gcc/edit-context.h b/gcc/diagnostics/edit-context.h
similarity index 92%
rename from gcc/edit-context.h
rename to gcc/diagnostics/edit-context.h
index 9bd2abaa5117..63ade305c7a8 100644
--- a/gcc/edit-context.h
+++ b/gcc/diagnostics/edit-context.h
@@ -17,12 +17,15 @@ You should have received a copy of the GNU General Public 
License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#ifndef GCC_EDIT_CONTEXT_H
-#define GCC_EDIT_CONTEXT_H
+#ifndef GCC_DIAGNOSTICS_EDIT_CONTEXT_H
+#define GCC_DIAGNOSTICS_EDIT_CONTEXT_H
 
 #include "typed-splay-tree.h"
 
 class fixit_hint;
+
+namespace diagnostics {
+
 class edit_context;
 class edited_file;
 
@@ -68,4 +71,6 @@ class edit_context
   typed_splay_tree<const char *, edited_file *> m_files;
 };
 
-#endif /* GCC_EDIT_CONTEXT_H.  */
+} // namespace diagnostics
+
+#endif /* GCC_DIAGNOSTICS_EDIT_CONTEXT_H.  */
diff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc
index 7e93593da2a9..a1a5b590faf7 100644
--- a/gcc/libgdiagnostics.cc
+++ b/gcc/libgdiagnostics.cc
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostics/digraphs.h"
 #include "diagnostics/state-graphs.h"
 #include "diagnostics/logical-locations.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
 #include "libgdiagnostics.h"
 #include "libgdiagnostics-private.h"
 #include "pretty-print-format-impl.h"
@@ -670,7 +670,8 @@ public:
 
     diagnostic_text_starter (&m_dc) = diagnostic_text_sink::text_starter;
 
-    m_edit_context = std::make_unique <edit_context> (m_dc.get_file_cache ());
+    m_edit_context
+      = std::make_unique <diagnostics::edit_context> (m_dc.get_file_cache ());
   }
 
   ~diagnostic_manager ()
@@ -901,7 +902,7 @@ private:
   logical_locs_map_t m_logical_locs;
   const diagnostic *m_current_diag;
   const diagnostic_logical_location *m_prev_diag_logical_loc;
-  std::unique_ptr<edit_context> m_edit_context;
+  std::unique_ptr<diagnostics::edit_context> m_edit_context;
 };
 
 class impl_rich_location : public rich_location
diff --git a/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc 
b/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc
index 7b9b8d4c031c..8abed140ac9c 100644
--- a/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc
@@ -6,7 +6,7 @@
 #include "system.h"
 #include "coretypes.h"
 #include "diagnostic.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
 #include "selftest.h"
 #include "selftest-diagnostic.h"
 
@@ -52,7 +52,7 @@ test_richloc (rich_location *richloc)
                         richloc, DK_ERROR, dc.get_reference_printer ());
 
   /* Generate a diff.  */
-  edit_context ec (global_dc->get_file_cache ());
+  diagnostics::edit_context ec (global_dc->get_file_cache ());
   ec.add_fixits (richloc);
   char *diff = ec.generate_diff (true);
   free (diff);
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 931466ca6324..1ce61f140d3a 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -81,7 +81,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-utils.h"
 #include "gcse.h"
 #include "omp-offload.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
 #include "tree-pass.h"
 #include "dumpfile.h"
 #include "ipa-fnsummary.h"
-- 
2.26.3

Reply via email to