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 <dmalcolm@redhat.com>
#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"
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"));
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 ();
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);
{
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
{
#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"
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:
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
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;
(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);
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. */
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);
/* "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). */
{
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
{
#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"
}
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 ();
/* 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);
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
{
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;
#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"
/* 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
class manager;
} // namespace diagnostics::logical_locations
+ class diagram;
+
} // namespace diagnostics
namespace text_art
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;
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);
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)
{
const char *const m_alt_text;
};
-#endif /* ! GCC_DIAGNOSTIC_DIAGRAM_H */
+} // namespace diagnostics
+
+#endif /* ! GCC_DIAGNOSTICS_DIAGRAM_H */
#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"
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);
}