OBJS-libcommon = diagnostic-spec.o diagnostic.o diagnostic-color.o \
diagnostic-global-context.o \
diagnostic-macro-unwinding.o \
- diagnostic-show-locus.o \
diagnostics/digraphs.o \
diagnostics/edit-context.o \
diagnostics/output-spec.o \
diagnostics/text-sink.o \
diagnostics/paths.o \
diagnostics/paths-output.o \
+ diagnostics/source-printing.o \
diagnostics/state-graphs.o \
diagnostics/state-graphs-to-dot.o \
diagnostics/selftest-logical-locations.o \
class sink;
class text_sink;
+ class source_effect_info;
+
} // namespace diagnostics
namespace text_art
virtual char *make_option_url (diagnostic_option_id option_id) const = 0;
};
-class diagnostic_source_effect_info;
-
/* A stack of sets of classifications: each entry in the stack is
a mapping from option index to diagnostic severity that can be changed
via pragmas. The stack can be pushed and popped. */
print (pretty_printer &pp,
const rich_location &richloc,
diagnostic_t diagnostic_kind,
- diagnostic_source_effect_info *effect_info) const;
+ diagnostics::source_effect_info *effect_info) const;
void
print_as_html (xml::printer &xp,
const rich_location &richloc,
diagnostic_t diagnostic_kind,
- diagnostic_source_effect_info *effect_info,
+ diagnostics::source_effect_info *effect_info,
html_label_writer *label_writer) const;
const diagnostic_source_printing_options &
const diagnostic_source_printing_options &opts,
diagnostic_t diagnostic_kind,
pretty_printer &pp,
- diagnostic_source_effect_info *effect_info);
+ diagnostics::source_effect_info *effect_info);
void maybe_show_locus_as_html (const rich_location &richloc,
const diagnostic_source_printing_options &opts,
diagnostic_t diagnostic_kind,
xml::printer &xp,
- diagnostic_source_effect_info *effect_info,
+ diagnostics::source_effect_info *effect_info,
html_label_writer *label_writer);
void emit_diagram (const diagnostics::diagram &diag);
rich_location *richloc,
diagnostic_t diagnostic_kind,
pretty_printer *pp,
- diagnostic_source_effect_info *effect_info = nullptr)
+ diagnostics::source_effect_info *effect_info = nullptr)
{
gcc_assert (context);
gcc_assert (richloc);
rich_location *richloc,
diagnostic_t diagnostic_kind,
xml::printer &xp,
- diagnostic_source_effect_info *effect_info = nullptr,
+ diagnostics::source_effect_info *effect_info = nullptr,
html_label_writer *label_writer = nullptr)
{
gcc_assert (context);
#include "gcc-rich-location.h"
#include "diagnostic-color.h"
#include "diagnostics/event-id.h"
-#include "diagnostic-label-effects.h"
+#include "diagnostics/source-printing-effects.h"
#include "pretty-print-markup.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
return result;
}
- const label_effects *get_effects (unsigned /*range_idx*/) const final override
+ const diagnostics::label_effects *
+ get_effects (unsigned /*range_idx*/) const final override
{
return &m_effects;
}
void print_as_text (pretty_printer &pp,
diagnostics::text_sink &text_output,
- diagnostic_source_effect_info *effect_info)
+ diagnostics::source_effect_info *effect_info)
{
location_t initial_loc = m_initial_event.get_location ();
void print_as_html (xml::printer &xp,
diagnostic_context &dc,
- diagnostic_source_effect_info *effect_info,
+ diagnostics::source_effect_info *effect_info,
html_label_writer *event_label_writer)
{
location_t initial_loc = m_initial_event.get_location ();
pretty_printer *pp,
const logical_locations::manager &logical_loc_mgr,
event_range *range,
- diagnostic_source_effect_info *effect_info)
+ diagnostics::source_effect_info *effect_info)
{
gcc_assert (pp);
const char *const line_color = "path";
xml::printer &xp,
html_label_writer *event_label_writer,
event_range *range,
- diagnostic_source_effect_info *effect_info)
+ diagnostics::source_effect_info *effect_info)
{
range->print_as_html (xp, dc, effect_info, event_label_writer);
m_num_printed++;
thread_event_printer &tep = thread_event_printers[swimlane_idx];
/* Wire up any trailing out-edge from previous range to leading in-edge
of this range. */
- diagnostic_source_effect_info effect_info;
+ diagnostics::source_effect_info effect_info;
effect_info.m_leading_in_edge_column = last_out_edge_column;
tep.print_swimlane_for_event_range_as_text
(text_output, pp,
thread_event_printer &tep = thread_event_printers[swimlane_idx];
/* Wire up any trailing out-edge from previous range to leading in-edge
of this range. */
- diagnostic_source_effect_info effect_info;
+ diagnostics::source_effect_info effect_info;
effect_info.m_leading_in_edge_column = last_out_edge_column;
tep.print_swimlane_for_event_range_as_html (dc, xp, event_label_writer,
range, &effect_info);
#include "sbitmap.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
-#include "selftest-diagnostic-show-locus.h"
+#include "diagnostics/selftest-source-printing.h"
#include "selftest-json.h"
#include "text-range-label.h"
#include "pretty-print-format-impl.h"
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-#ifndef GCC_SELFTEST_DIAGNOSTIC_SHOW_LOCUS_H
-#define GCC_SELFTEST_DIAGNOSTIC_SHOW_LOCUS_H
+#ifndef GCC_DIAGNOSTICS_SELFTEST_SOURCE_PRINTING_H
+#define GCC_DIAGNOSTICS_SELFTEST_SOURCE_PRINTING_H
#include "selftest.h"
#endif /* #if CHECKING_P */
-#endif /* GCC_SELFTEST_DIAGNOSTIC_SHOW_LOCUS_H */
+#endif /* GCC_DIAGNOSTICS_SELFTEST_SOURCE_PRINTING_H */
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-#ifndef GCC_DIAGNOSTIC_LABEL_EFFECTS_H
-#define GCC_DIAGNOSTIC_LABEL_EFFECTS_H
+#ifndef GCC_DIAGNOSTICS_SOURCE_PRINTING_EFFECTS_H
+#define GCC_DIAGNOSTICS_SOURCE_PRINTING_EFFECTS_H
+
+namespace diagnostics {
/* Abstract base class for describing special effects when printing
a label when quoting source code. */
/* A class to hold state when quoting a run of lines of source code. */
-class diagnostic_source_effect_info
+class source_effect_info
{
public:
- diagnostic_source_effect_info ()
+ source_effect_info ()
: m_leading_in_edge_column (-1),
m_trailing_out_edge_column (-1)
{
int m_trailing_out_edge_column;
};
-#endif /* GCC_DIAGNOSTIC_LABEL_EFFECTS_H */
+} // namespace diagnostics
+
+#endif /* GCC_DIAGNOSTICS_SOURCE_PRINTING_EFFECTS_H */
#include "text-range-label.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
-#include "selftest-diagnostic-show-locus.h"
+#include "diagnostics/selftest-source-printing.h"
#include "cpplib.h"
#include "text-art/types.h"
#include "text-art/theme.h"
-#include "diagnostic-label-effects.h"
+#include "diagnostics/source-printing-effects.h"
#include "xml.h"
#include "xml-printer.h"
layout (const diagnostic_source_print_policy &source_policy,
const rich_location &richloc,
- diagnostic_source_effect_info *effect_info = nullptr);
+ diagnostics::source_effect_info *effect_info = nullptr);
bool maybe_add_location_range (const location_range *loc_range,
unsigned original_idx,
file_cache &m_file_cache;
const text_art::ascii_theme m_fallback_theme;
const text_art::theme &m_theme;
- diagnostic_source_effect_info *m_effect_info;
+ diagnostics::source_effect_info *m_effect_info;
char_display_policy m_char_policy;
location_t m_primary_loc;
exploc_with_display_col m_exploc;
{
if (!m_label)
return false;
- const label_effects *effects = m_label->get_effects (m_original_idx);
+ const diagnostics::label_effects *effects
+ = m_label->get_effects (m_original_idx);
if (!effects)
return false;
{
if (!m_label)
return false;
- const label_effects *effects = m_label->get_effects (m_original_idx);
+ const diagnostics::label_effects *effects
+ = m_label->get_effects (m_original_idx);
if (!effects)
return false;
layout::layout (const diagnostic_source_print_policy &source_policy,
const rich_location &richloc,
- diagnostic_source_effect_info *effect_info)
+ diagnostics::source_effect_info *effect_info)
: m_options (source_policy.get_options ()),
m_line_table (richloc.get_line_table ()),
m_file_cache (source_policy.get_file_cache ()),
const diagnostic_source_printing_options &opts,
diagnostic_t diagnostic_kind,
pretty_printer &pp,
- diagnostic_source_effect_info *effects)
+ diagnostics::source_effect_info *effects)
{
const location_t loc = richloc.get_loc ();
/* Do nothing if source-printing has been disabled. */
const diagnostic_source_printing_options &opts,
diagnostic_t diagnostic_kind,
xml::printer &xp,
- diagnostic_source_effect_info *effects,
+ diagnostics::source_effect_info *effects,
html_label_writer *label_writer)
{
const location_t loc = richloc.get_loc ();
diagnostic_source_print_policy::print (pretty_printer &pp,
const rich_location &richloc,
diagnostic_t diagnostic_kind,
- diagnostic_source_effect_info *effects)
+ diagnostics::source_effect_info *effects)
const
{
layout layout (*this, richloc, effects);
diagnostic_source_print_policy::print_as_html (xml::printer &xp,
const rich_location &richloc,
diagnostic_t diagnostic_kind,
- diagnostic_source_effect_info *effects,
+ diagnostics::source_effect_info *effects,
html_label_writer *label_writer)
const
{
/* Run all of the selftests within this file. */
void
-diagnostic_show_locus_cc_tests ()
+diagnostics_source_printing_cc_tests ()
{
test_line_span ();
if (!added secondary)
inform (secondary_loc, "message for secondary");
- Implemented in diagnostic-show-locus.cc. */
+ Implemented in diagnostics/source-printing.cc. */
bool add_location_if_nearby (const diagnostic_source_print_policy &policy,
location_t loc,
/* Higher-level tests, or for components that other selftests don't
rely on. */
diagnostic_color_cc_tests ();
- diagnostic_show_locus_cc_tests ();
+ diagnostics_source_printing_cc_tests ();
diagnostics_html_sink_cc_tests ();
diagnostics_sarif_sink_cc_tests ();
diagnostics_digraphs_cc_tests ();
extern void convert_cc_tests ();
extern void dbgcnt_cc_tests ();
extern void diagnostic_color_cc_tests ();
-extern void diagnostic_show_locus_cc_tests ();
extern void diagnostics_digraphs_cc_tests ();
extern void diagnostics_html_sink_cc_tests ();
extern void diagnostics_lazy_paths_cc_tests ();
extern void diagnostics_paths_output_cc_tests ();
extern void diagnostics_sarif_sink_cc_tests ();
extern void diagnostics_selftest_logical_locations_cc_tests ();
+extern void diagnostics_source_printing_cc_tests ();
extern void diagnostics_state_graphs_cc_tests ();
extern void digraph_cc_tests ();
extern void dumpfile_cc_tests ();
-/* Verify colorization of the labels in diagnostic-show-locus.c
+/* Verify colorization of the labels in diagnostics/source-printing.cc
for template comparisons.
Doing so requires a plugin; see the comments in the plugin for the
rationale. */
-# Verify that diagnostic-show-locus.cc works with HTML output.
+# Verify that diagnostics/source-printing.cc works with HTML output.
from htmltest import *
This is a tabstop value, along with a callback for getting the
widths of characters. Normally this callback is cpp_wcwidth, but we
support other schemes for escaping non-ASCII unicode as a series of
- ASCII chars when printing the user's source code in diagnostic-show-locus.cc
+ ASCII chars when printing the user's source code in
+ gcc/diagnostics/source-printing.cc
For example, consider:
- the Unicode character U+03C0 "GREEK SMALL LETTER PI" (UTF-8: 0xCF 0x80)
#include "label-text.h"
class range_label;
-class label_effects;
+namespace diagnostics { class label_effects; }
/* A hint to diagnostic_show_locus on how to print a source range within a
rich_location.
virtual label_text get_text (unsigned range_idx) const = 0;
/* Get any special effects for the label (e.g. links to other labels). */
- virtual const label_effects *get_effects (unsigned /*range_idx*/) const
+ virtual const diagnostics::label_effects *
+ get_effects (unsigned /*range_idx*/) const
{
return nullptr;
}