No functional change intended.

gcc/analyzer/ChangeLog:
        * bounds-checking.cc: Update #include for move of
        "diagnostic-diagram.h" to "diagnostics/diagram.h". Update for
        move of diagnostic_diagram to diagnostics::diagram.

gcc/ChangeLog:
        * diagnostic-format-html.cc: Update for move of diagnostic_diagram
        to diagnostics::diagram.
        * diagnostic-format-sarif.cc: Update #include for move of
        "diagnostic-diagram.h" to "diagnostics/diagram.h". Update for move
        of diagnostic_diagram to diagnostics::diagram.
        * diagnostic-format-text.cc: Likewise.
        * diagnostic-format-text.h: Update for move of diagnostic_diagram
        to diagnostics::diagram.
        * diagnostic-format.h: Likewise.
        * diagnostic.cc: Update #include for move of
        "diagnostic-diagram.h" to "diagnostics/diagram.h". Update for move
        of diagnostic_diagram to diagnostics::diagram.
        * diagnostic.h: Update for move of diagnostic_diagram to
        diagnostics::diagram.
        * diagnostic-diagram.h: Move to...
        * diagnostics/diagram.h: ...here.
        (class diagnostic_diagram): Convert to...
        (class diagnostics::diagram): ...this.

gcc/testsuite/ChangeLog:
        * gcc.dg/plugin/diagnostic_plugin_test_text_art.cc: Update
        #include for move of "diagnostic-diagram.h" to
        "diagnostics/diagram.h". Update for move of diagnostic_diagram to
        diagnostics::diagram.

Signed-off-by: David Malcolm <dmalc...@redhat.com>
---
 gcc/analyzer/bounds-checking.cc               |  4 +--
 gcc/diagnostic-format-html.cc                 |  8 +++---
 gcc/diagnostic-format-sarif.cc                | 28 +++++++++----------
 gcc/diagnostic-format-text.cc                 |  6 ++--
 gcc/diagnostic-format-text.h                  |  2 +-
 gcc/diagnostic-format.h                       |  2 +-
 gcc/diagnostic.cc                             |  6 ++--
 gcc/diagnostic.h                              |  5 ++--
 .../diagram.h}                                | 16 +++++++----
 .../plugin/diagnostic_plugin_test_text_art.cc |  4 +--
 10 files changed, 43 insertions(+), 38 deletions(-)
 rename gcc/{diagnostic-diagram.h => diagnostics/diagram.h} (83%)

diff --git a/gcc/analyzer/bounds-checking.cc b/gcc/analyzer/bounds-checking.cc
index d2e2b34e2850..732c05ddb25b 100644
--- a/gcc/analyzer/bounds-checking.cc
+++ b/gcc/analyzer/bounds-checking.cc
@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "analyzer/common.h"
 
 #include "intl.h"
-#include "diagnostic-diagram.h"
+#include "diagnostics/diagram.h"
 #include "diagnostic-format-sarif.h"
 
 #include "analyzer/analyzer-logging.h"
@@ -181,7 +181,7 @@ protected:
               a problem.  Give up if that's happened.  */
            return;
          }
-       diagnostic_diagram diagram
+       diagnostics::diagram diagram
          (canvas,
           /* Alt text.  */
           _("Diagram visualizing the predicted out-of-bounds access"));
diff --git a/gcc/diagnostic-format-html.cc b/gcc/diagnostic-format-html.cc
index ceca1612fd61..33dca5c0147c 100644
--- a/gcc/diagnostic-format-html.cc
+++ b/gcc/diagnostic-format-html.cc
@@ -122,7 +122,7 @@ public:
   void on_report_diagnostic (const diagnostic_info &diagnostic,
                             diagnostic_t orig_diag_kind,
                             diagnostic_html_format_buffer *buffer);
-  void emit_diagram (const diagnostic_diagram &diagram);
+  void emit_diagram (const diagram &d);
   void emit_global_graph (const digraphs::lazy_digraph &);
 
   void end_group ();
@@ -1240,7 +1240,7 @@ html_builder::make_element_for_metadata (const metadata 
&m)
    for HTML output.  */
 
 void
-html_builder::emit_diagram (const diagnostic_diagram &/*diagram*/)
+html_builder::emit_diagram (const diagram &)
 {
   /* We must be within the emission of a top-level diagnostic.  */
   gcc_assert (m_cur_diagnostic_element);
@@ -1364,9 +1364,9 @@ public:
   {
     m_builder.on_report_diagnostic (diagnostic, orig_diag_kind, m_buffer);
   }
-  void on_diagram (const diagnostic_diagram &diagram) final override
+  void on_diagram (const diagram &d) final override
   {
-    m_builder.emit_diagram (diagram);
+    m_builder.emit_diagram (d);
   }
   void after_diagnostic (const diagnostic_info &) final override
   {
diff --git a/gcc/diagnostic-format-sarif.cc b/gcc/diagnostic-format-sarif.cc
index 44d94c758836..5663e778f155 100644
--- a/gcc/diagnostic-format-sarif.cc
+++ b/gcc/diagnostic-format-sarif.cc
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cpplib.h"
 #include "diagnostics/logical-locations.h"
 #include "diagnostic-client-data-hooks.h"
-#include "diagnostic-diagram.h"
+#include "diagnostics/diagram.h"
 #include "text-art/canvas.h"
 #include "diagnostic-format-sarif.h"
 #include "diagnostic-format-text.h"
@@ -454,7 +454,7 @@ public:
   on_nested_diagnostic (const diagnostic_info &diagnostic,
                        diagnostic_t orig_diag_kind,
                        sarif_builder &builder);
-  void on_diagram (const diagnostic_diagram &diagram,
+  void on_diagram (const diagram &d,
                   sarif_builder &builder);
 
 private:
@@ -777,7 +777,7 @@ public:
   void on_report_diagnostic (const diagnostic_info &diagnostic,
                             diagnostic_t orig_diag_kind,
                             diagnostic_sarif_format_buffer *buffer);
-  void emit_diagram (const diagnostic_diagram &diagram);
+  void emit_diagram (const diagram &d);
   void end_group ();
 
   void
@@ -807,7 +807,7 @@ public:
   std::unique_ptr<sarif_message>
   make_message_object (const char *msg) const;
   std::unique_ptr<sarif_message>
-  make_message_object_for_diagram (const diagnostic_diagram &diagram);
+  make_message_object_for_diagram (const diagram &d);
   std::unique_ptr<sarif_artifact_content>
   maybe_make_artifact_content_object (const char *filename) const;
 
@@ -1338,11 +1338,11 @@ sarif_result::on_nested_diagnostic (const 
diagnostic_info &diagnostic,
    (SARIF v2.1.0 section 3.28.5).  */
 
 void
-sarif_result::on_diagram (const diagnostic_diagram &diagram,
+sarif_result::on_diagram (const diagram &d,
                          sarif_builder &builder)
 {
   auto location_obj = std::make_unique<sarif_location> ();
-  auto message_obj = builder.make_message_object_for_diagram (diagram);
+  auto message_obj = builder.make_message_object_for_diagram (d);
   location_obj->set<sarif_message> ("message", std::move (message_obj));
 
   add_related_location (std::move (location_obj), builder);
@@ -1887,11 +1887,11 @@ sarif_builder::on_report_diagnostic (const 
diagnostic_info &diagnostic,
    for SARIF output.  */
 
 void
-sarif_builder::emit_diagram (const diagnostic_diagram &diagram)
+sarif_builder::emit_diagram (const diagram &d)
 {
   /* We must be within the emission of a top-level diagnostic.  */
   gcc_assert (m_cur_group_result);
-  m_cur_group_result->on_diagram (diagram, *this);
+  m_cur_group_result->on_diagram (d, *this);
 }
 
 /* Implementation of "end_group_cb" for SARIF output.  */
@@ -3249,18 +3249,18 @@ sarif_builder::make_message_object (const char *msg) 
const
   return message_obj;
 }
 
-/* Make a "message" object (SARIF v2.1.0 section 3.11) for DIAGRAM.
+/* Make a "message" object (SARIF v2.1.0 section 3.11) for D.
    We emit the diagram as a code block within the Markdown part
    of the message.  */
 
 std::unique_ptr<sarif_message>
-sarif_builder::make_message_object_for_diagram (const diagnostic_diagram 
&diagram)
+sarif_builder::make_message_object_for_diagram (const diagram &d)
 {
   auto message_obj = std::make_unique<sarif_message> ();
 
   /* "text" property (SARIF v2.1.0 section 3.11.8).  */
   set_string_property_escaping_braces (*message_obj,
-                                      "text", diagram.get_alt_text ());
+                                      "text", d.get_alt_text ());
 
   pretty_printer *const pp = m_printer;
   char *saved_prefix = pp_take_prefix (pp);
@@ -3269,7 +3269,7 @@ sarif_builder::make_message_object_for_diagram (const 
diagnostic_diagram &diagra
   /* "To produce a code block in Markdown, simply indent every line of
      the block by at least 4 spaces or 1 tab."
      Here we use 4 spaces.  */
-  diagram.get_canvas ().print_to_pp (pp, "    ");
+  d.get_canvas ().print_to_pp (pp, "    ");
   pp_set_prefix (pp, saved_prefix);
 
   /* "markdown" property (SARIF v2.1.0 section 3.11.9).  */
@@ -3915,9 +3915,9 @@ public:
   {
     m_builder.on_report_diagnostic (diagnostic, orig_diag_kind, m_buffer);
   }
-  void on_diagram (const diagnostic_diagram &diagram) final override
+  void on_diagram (const diagnostics::diagram &d) final override
   {
-    m_builder.emit_diagram (diagram);
+    m_builder.emit_diagram (d);
   }
   void after_diagnostic (const diagnostic_info &) final override
   {
diff --git a/gcc/diagnostic-format-text.cc b/gcc/diagnostic-format-text.cc
index 0696a349b51c..5df117d40ce5 100644
--- a/gcc/diagnostic-format-text.cc
+++ b/gcc/diagnostic-format-text.cc
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostics/metadata.h"
 #include "diagnostic-path.h"
 #include "diagnostic-client-data-hooks.h"
-#include "diagnostic-diagram.h"
+#include "diagnostics/diagram.h"
 #include "diagnostic-format-text.h"
 #include "diagnostic-buffer.h"
 #include "text-art/theme.h"
@@ -258,7 +258,7 @@ diagnostic_text_output_format::on_report_verbatim 
(text_info &text)
 }
 
 void
-diagnostic_text_output_format::on_diagram (const diagnostic_diagram &diagram)
+diagnostic_text_output_format::on_diagram (const diagnostics::diagram &d)
 {
   pretty_printer *const pp = get_printer ();
 
@@ -267,7 +267,7 @@ diagnostic_text_output_format::on_diagram (const 
diagnostic_diagram &diagram)
   /* Use a newline before and after and a two-space indent
      to make the diagram stand out a little from the wall of text.  */
   pp_newline (pp);
-  diagram.get_canvas ().print_to_pp (pp, "  ");
+  d.get_canvas ().print_to_pp (pp, "  ");
   pp_newline (pp);
   pp_set_prefix (pp, saved_prefix);
   pp_flush (pp);
diff --git a/gcc/diagnostic-format-text.h b/gcc/diagnostic-format-text.h
index 64a4452e6ca9..bcaabf874fbd 100644
--- a/gcc/diagnostic-format-text.h
+++ b/gcc/diagnostic-format-text.h
@@ -60,7 +60,7 @@ public:
   void on_report_diagnostic (const diagnostic_info &,
                             diagnostic_t orig_diag_kind) override;
   void on_report_verbatim (text_info &) final override;
-  void on_diagram (const diagnostic_diagram &diagram) override;
+  void on_diagram (const diagnostics::diagram &d) override;
   void after_diagnostic (const diagnostic_info &) override;
   bool machine_readable_stderr_p () const final override
   {
diff --git a/gcc/diagnostic-format.h b/gcc/diagnostic-format.h
index a4c776c30b0d..113e7ba554a9 100644
--- a/gcc/diagnostic-format.h
+++ b/gcc/diagnostic-format.h
@@ -61,7 +61,7 @@ public:
 
   virtual void on_report_verbatim (text_info &);
 
-  virtual void on_diagram (const diagnostic_diagram &diagram) = 0;
+  virtual void on_diagram (const diagnostics::diagram &diag) = 0;
   virtual void after_diagnostic (const diagnostic_info &) = 0;
   virtual bool machine_readable_stderr_p () const = 0;
   virtual bool follows_reference_printer_p () const = 0;
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 86bf4e3180a2..09329f0712f6 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostics/metadata.h"
 #include "diagnostic-path.h"
 #include "diagnostic-client-data-hooks.h"
-#include "diagnostic-diagram.h"
+#include "diagnostics/diagram.h"
 #include "diagnostic-format.h"
 #include "diagnostic-format-sarif.h"
 #include "diagnostic-format-text.h"
@@ -1744,13 +1744,13 @@ diagnostic_context::diagnostic_n_impl (rich_location 
*richloc,
 /* Emit DIAGRAM to this context, respecting the output format.  */
 
 void
-diagnostic_context::emit_diagram (const diagnostic_diagram &diagram)
+diagnostic_context::emit_diagram (const diagnostics::diagram &diag)
 {
   if (m_diagrams.m_theme == nullptr)
     return;
 
   for (auto sink : m_output_sinks)
-    sink->on_diagram (diagram);
+    sink->on_diagram (diag);
 }
 
 /* Inform the user that an error occurred while trying to report some
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 70156fed236a..4ddc4b062d2a 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -38,6 +38,8 @@ namespace diagnostics {
     class manager;
   } // namespace diagnostics::logical_locations
 
+  class diagram;
+
 } // namespace diagnostics
 
 namespace text_art
@@ -235,7 +237,6 @@ public:
 
 class edit_context;
 class diagnostic_client_data_hooks;
-class diagnostic_diagram;
 class diagnostic_source_effect_info;
 class diagnostic_output_format;
   class diagnostic_text_output_format;
@@ -666,7 +667,7 @@ public:
                                 diagnostic_source_effect_info *effect_info,
                                 html_label_writer *label_writer);
 
-  void emit_diagram (const diagnostic_diagram &diagram);
+  void emit_diagram (const diagnostics::diagram &diag);
 
   /* Various setters for use by option-handling logic.  */
   void set_output_format (std::unique_ptr<diagnostic_output_format> 
output_format);
diff --git a/gcc/diagnostic-diagram.h b/gcc/diagnostics/diagram.h
similarity index 83%
rename from gcc/diagnostic-diagram.h
rename to gcc/diagnostics/diagram.h
index b1ff9a98f6a3..2d33b1058496 100644
--- a/gcc/diagnostic-diagram.h
+++ b/gcc/diagnostics/diagram.h
@@ -18,22 +18,24 @@ 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_DIAGNOSTIC_DIAGRAM_H
-#define GCC_DIAGNOSTIC_DIAGRAM_H
+#ifndef GCC_DIAGNOSTICS_DIAGRAM_H
+#define GCC_DIAGNOSTICS_DIAGRAM_H
 
 namespace text_art
 {
   class canvas;
 } // namespace text_art
 
+namespace diagnostics {
+
 /* A text art diagram, along with an "alternative text" string
    describing it.  */
 
-class diagnostic_diagram
+class diagram
 {
  public:
-  diagnostic_diagram (const text_art::canvas &canvas,
-                     const char *alt_text)
+  diagram (const text_art::canvas &canvas,
+          const char *alt_text)
   : m_canvas (canvas),
     m_alt_text (alt_text)
   {
@@ -48,4 +50,6 @@ class diagnostic_diagram
   const char *const m_alt_text;
 };
 
-#endif /* ! GCC_DIAGNOSTIC_DIAGRAM_H */
+} // namespace diagnostics
+
+#endif /* ! GCC_DIAGNOSTICS_DIAGRAM_H */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.cc 
b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.cc
index e28d69758dae..ce2f1d3be43d 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.cc
@@ -9,7 +9,7 @@
 #include "coretypes.h"
 #include "plugin-version.h"
 #include "diagnostic.h"
-#include "diagnostic-diagram.h"
+#include "diagnostics/diagram.h"
 #include "text-art/canvas.h"
 #include "text-art/table.h"
 
@@ -22,7 +22,7 @@ using namespace text_art;
 static void
 emit_canvas (const canvas &c, const char *alt_text)
 {
-  diagnostic_diagram diagram (c, alt_text);
+  diagnostics::diagram diagram (c, alt_text);
   global_dc->emit_diagram (diagram);
 }
 
-- 
2.26.3

Reply via email to