aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-06-12 09:15:09 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2024-06-12 09:15:09 -0400
commitc5e3be456888aa48f591512ec28183703e70978c (patch)
tree0c2e238f92f0e41c80708e258c6060b1d1d8c9a6 /gcc/cp
parentfc47393acfae8188c131e46bc1c5379c722eab84 (diff)
downloadgcc-c5e3be456888aa48f591512ec28183703e70978c.zip
gcc-c5e3be456888aa48f591512ec28183703e70978c.tar.gz
gcc-c5e3be456888aa48f591512ec28183703e70978c.tar.bz2
pretty_printer: make all fields private
No functional change intended. gcc/analyzer/ChangeLog: * access-diagram.cc (access_range::dump): Update for fields of pretty_printer becoming private. * call-details.cc (call_details::dump): Likewise. * call-summary.cc (call_summary::dump): Likewise. (call_summary_replay::dump): Likewise. * checker-event.cc (checker_event::debug): Likewise. * constraint-manager.cc (range::dump): Likewise. (bounded_range::dump): Likewise. (constraint_manager::dump): Likewise. * engine.cc (exploded_node::dump): Likewise. (exploded_path::dump): Likewise. (exploded_path::dump_to_file): Likewise. * feasible-graph.cc (feasible_graph::dump_feasible_path): Likewise. * program-point.cc (program_point::dump): Likewise. * program-state.cc (extrinsic_state::dump_to_file): Likewise. (sm_state_map::dump): Likewise. (program_state::dump_to_file): Likewise. * ranges.cc (symbolic_byte_offset::dump): Likewise. (symbolic_byte_range::dump): Likewise. * record-layout.cc (record_layout::dump): Likewise. * region-model-reachability.cc (reachable_regions::dump): Likewise. * region-model.cc (region_to_value_map::dump): Likewise. (region_model::dump): Likewise. (model_merger::dump): Likewise. * region-model.h (one_way_id_map<T>::dump): Likewise. * region.cc (region_offset::dump): Likewise. (region::dump): Likewise. * sm-malloc.cc (deallocator_set::dump): Likewise. * store.cc (uncertainty_t::dump): Likewise. (binding_key::dump): Likewise. (bit_range::dump): Likewise. (byte_range::dump): Likewise. (binding_map::dump): Likewise. (binding_cluster::dump): Likewise. (store::dump): Likewise. * supergraph.cc (supergraph::dump_dot_to_file): Likewise. (superedge::dump): Likewise. * svalue.cc (svalue::dump): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc (dump_ads): Update for fields of pretty_printer becoming private. * c-pretty-print.cc: Likewise throughout. gcc/c/ChangeLog: * c-objc-common.cc (print_type): Update for fields of pretty_printer becoming private. (c_tree_printer): Likewise. gcc/cp/ChangeLog: * cxx-pretty-print.cc: Update throughout for fields of pretty_printer becoming private. * error.cc: Likewise. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::urls_init): Update for fields of pretty_printer becoming private. (diagnostic_context::print_any_cwe): Likewise. (diagnostic_context::print_any_rules): Likewise. (diagnostic_context::print_option_information): Likewise. * diagnostic.h (diagnostic_format_decoder): Likewise. (diagnostic_prefixing_rule): Likewise, fixing typo. * digraph.cc (test_dump_to_dot): Likewise. * digraph.h (digraph<GraphTraits>::dump_dot_to_file): Likewise. * dumpfile.cc (dump_pretty_printer::emit_any_pending_textual_chunks): Likewise. * gimple-pretty-print.cc (print_gimple_stmt): Likewise. (print_gimple_expr): Likewise. (print_gimple_seq): Likewise. (dump_ssaname_info_to_file): Likewise. (gimple_dump_bb): Likewise. * graph.cc (print_graph_cfg): Likewise. (start_graph_dump): Likewise. * langhooks.cc (lhd_print_error_function): Likewise. * lto-wrapper.cc (print_lto_docs_link): Likewise. * pretty-print.cc (pp_set_real_maximum_length): Convert to... (pretty_printer::set_real_maximum_length): ...this. (pp_clear_state): Convert to... (pretty_printer::clear_state): ...this. (pp_wrap_text): Update for pp_remaining_character_count_for_line becoming a member function. (urlify_quoted_string): Update for fields of pretty_printer becoming private. (pp_format): Convert to... (pretty_printer::format): ...this. Reduce the scope of local variables "old_line_length" and "old_wrapping_mode" and make const. Reduce the scope of locals "args", "new_chunk_array", "curarg", "any_unnumbered", and "any_numbered". (pp_output_formatted_text): Update for fields of pretty_printer becoming private. (pp_flush): Likewise. (pp_really_flush): Likewise. (pp_set_line_maximum_length): Likewise. (pp_set_prefix): Convert to... (pretty_printer::set_prefix): ...this. (pp_take_prefix): Update for fields of pretty_printer gaining "m_" prefixes. (pp_destroy_prefix): Likewise. (pp_emit_prefix): Convert to... (pretty_printer::emit_prefix): ...this. (pretty_printer::pretty_printer): Update both ctors for fields gaining "m_" prefixes. (pretty_printer::~pretty_printer): Likewise for dtor. (pp_append_text): Update for pp_emit_prefix becoming pretty_printer::emit_prefix. (pp_remaining_character_count_for_line): Convert to... (pretty_printer::remaining_character_count_for_line): ...this. (pp_character): Update for above change. (pp_maybe_space): Convert to... (pretty_printer::maybe_space): ...this. (pp_begin_url): Convert to... (pretty_printer::begin_url): ...this. (get_end_url_string): Update for fields of pretty_printer becoming private. (pp_end_url): Convert to... (pretty_printer::end_url): ...this. (selftest::test_pretty_printer::test_pretty_printer): Update for fields of pretty_printer becoming private. (selftest::test_urls): Likewise. (selftest::test_null_urls): Likewise. (selftest::test_urlification): Likewise. * pretty-print.h (pp_line_cutoff): Convert from macro to inline function. (pp_prefixing_rule): Likewise. (pp_wrapping_mode): Likewise. (pp_format_decoder): Likewise. (pp_needs_newline): Likewise. (pp_indentation): Likewise. (pp_translate_identifiers): Likewise. (pp_show_color): Likewise. (pp_buffer): Likewise. (pp_get_prefix): Add forward decl to allow friend decl. (pp_take_prefix): Likewise. (pp_destroy_prefix): Likewise. (class pretty_printer): Fix typo in leading comment. Add "friend" decls for the various new accessor functions that were formerly macros and for pp_get_prefix, pp_take_prefix, and pp_destroy_prefix. Make all fields private. (pretty_printer::set_output_stream): New. (pretty_printer::set_prefix): New decl. (pretty_printer::emit_prefix): New decl. (pretty_printer::format): New decl. (pretty_printer::maybe_space): New decl. (pretty_printer::supports_urls_p): New. (pretty_printer::get_url_format): New. (pretty_printer::set_url_format): New. (pretty_printer::begin_url): New decl. (pretty_printer::end_url): New decl. (pretty_printer::set_verbatim_wrapping): New. (pretty_printer::set_padding): New. (pretty_printer::get_padding): New. (pretty_printer::clear_state): New decl. (pretty_printer::set_real_maximum_length): New decl. (pretty_printer::remaining_character_count_for_line): New decl. (pretty_printer::buffer): Rename to... (pretty_printer::m_buffer): ...this. (pretty_printer::prefix): Rename to... (pretty_printer::m_prefix): ...this; (pretty_printer::padding): Rename to... (pretty_printer::m_padding): ...this; (pretty_printer::maximum_length): Rename to... (pretty_printer::m_maximum_length): ...this; (pretty_printer::indent_skip): Rename to... (pretty_printer::m_indent_skip): ...this; (pretty_printer::wrapping): Rename to... (pretty_printer::m_wrapping): ...this; (pretty_printer::format_decoder): Rename to... (pretty_printer::m_format_decoder): ...this; (pretty_printer::emitted_prefix): Rename to... (pretty_printer::m_emitted_prefix): ...this; (pretty_printer::need_newline): Rename to... (pretty_printer::m_need_newline): ...this; (pretty_printer::translate_identifiers): Rename to... (pretty_printer::m_translate_identifiers): ...this; (pretty_printer::show_color): Rename to... (pretty_printer::m_show_color): ...this; (pretty_printer::url_format): Rename to... (pretty_printer::m_url_format): ...this; (pp_get_prefix): Reformat. (pp_format_postprocessor): New inline function. (pp_take_prefix): Move decl to before class pretty_printer. (pp_destroy_prefix): Likewise. (pp_set_prefix): Convert to inline function. (pp_emit_prefix): Convert to inline function. (pp_format): Convert to inline function. (pp_maybe_space): Convert to inline function. (pp_begin_url): Convert to inline function. (pp_end_url): Convert to inline function. (pp_set_verbatim_wrapping): Convert from macro to inline function, renaming... (pp_set_verbatim_wrapping_): ...this. * print-rtl.cc (dump_value_slim): Update for fields of pretty_printer becoming private. (dump_insn_slim): Likewise. (dump_rtl_slim): Likewise. * print-tree.cc (print_node): Likewise. * sched-rgn.cc (dump_rgn_dependencies_dot): Likewise. * text-art/canvas.cc (canvas::print_to_pp): Likewise. (canvas::debug): Likewise. (selftest::test_canvas_urls): Likewise. * text-art/dump.h (dump_to_file): Likewise. * text-art/selftests.cc (selftest::assert_canvas_streq): Likewise. * text-art/style.cc (style::print_changes): Likewise. * text-art/styled-string.cc (styled_string::from_fmt_va): Likewise. * tree-diagnostic-path.cc (control_flow_tests): Update for pp_show_color becoming an inline function. * tree-loop-distribution.cc (dot_rdg_1): Update for fields of pretty_printer becoming private. * tree-pretty-print.cc (maybe_init_pretty_print): Likewise. * value-range.cc (vrange::dump): Likewise. (irange_bitmask::dump): Likewise. gcc/fortran/ChangeLog: * error.cc (gfc_clear_pp_buffer): Likewise. (gfc_warning): Likewise. (gfc_warning_check): Likewise. (gfc_error_opt): Likewise. (gfc_error_check): Likewise. gcc/jit/ChangeLog: * jit-recording.cc (recording::function::dump_to_dot): Update for fields of pretty_printer becoming private. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.c (dump_refcnt_info): Update for fields of pretty_printer becoming private. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/cxx-pretty-print.cc12
-rw-r--r--gcc/cp/error.cc37
2 files changed, 24 insertions, 25 deletions
diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc
index c6d8cc8..806aebf 100644
--- a/gcc/cp/cxx-pretty-print.cc
+++ b/gcc/cp/cxx-pretty-print.cc
@@ -49,7 +49,7 @@ pp_cxx_nonconsecutive_character (cxx_pretty_printer *pp, int c)
if (p != NULL && *p == c)
pp_cxx_whitespace (pp);
pp_character (pp, c);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
#define pp_cxx_expression_list(PP, T) \
@@ -65,7 +65,7 @@ void
pp_cxx_colon_colon (cxx_pretty_printer *pp)
{
pp_colon_colon (pp);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
void
@@ -84,7 +84,7 @@ void
pp_cxx_separate_with (cxx_pretty_printer *pp, int c)
{
pp_separate_with (pp, c);
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
}
/* Expressions. */
@@ -1702,7 +1702,7 @@ cxx_pretty_printer::direct_declarator (tree t)
if (DECL_IOBJ_MEMBER_FUNCTION_P (t))
{
- padding = pp_before;
+ set_padding (pp_before);
pp_cxx_cv_qualifier_seq (this, pp_cxx_implicit_parameter_type (t));
}
@@ -1859,7 +1859,7 @@ cxx_pretty_printer::direct_abstract_declarator (tree t)
direct_abstract_declarator (TREE_TYPE (t));
if (TREE_CODE (t) == METHOD_TYPE)
{
- padding = pp_before;
+ set_padding (pp_before);
pp_cxx_cv_qualifier_seq (this, class_of_this_parm (t));
}
pp_cxx_exception_specification (this, t);
@@ -2685,7 +2685,7 @@ pp_cxx_requires_clause (cxx_pretty_printer *pp, tree t)
{
if (!t)
return;
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_ws_string (pp, "requires");
pp_space (pp);
pp->expression (t);
diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index 0ff7f9d..01ad794 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -180,7 +180,7 @@ cxx_initialize_diagnostics (diagnostic_context *context)
diagnostic_starter (context) = cp_diagnostic_starter;
/* diagnostic_finalizer is already c_diagnostic_finalizer. */
diagnostic_format_decoder (context) = cp_printer;
- pp->m_format_postprocessor = new cxx_format_postprocessor ();
+ pp_format_postprocessor (pp) = new cxx_format_postprocessor ();
}
/* Dump an '@module' name suffix for DECL, if any. */
@@ -210,7 +210,7 @@ dump_module_suffix (cxx_pretty_printer *pp, tree decl)
if (const char *n = module_name (m, false))
{
pp_character (pp, '@');
- pp->padding = pp_none;
+ pp->set_padding (pp_none);
pp_string (pp, n);
}
}
@@ -921,7 +921,7 @@ dump_type_prefix (cxx_pretty_printer *pp, tree t, int flags)
else
pp_ampersand (pp);
}
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_cv_qualifier_seq (pp, t);
}
break;
@@ -939,7 +939,7 @@ dump_type_prefix (cxx_pretty_printer *pp, tree t, int flags)
}
pp_cxx_star (pp);
pp_cxx_cv_qualifier_seq (pp, t);
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
break;
/* This can be reached without a pointer when dealing with
@@ -986,7 +986,7 @@ dump_type_prefix (cxx_pretty_printer *pp, tree t, int flags)
case FIXED_POINT_TYPE:
case NULLPTR_TYPE:
dump_type (pp, t, flags);
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
break;
default:
@@ -1035,7 +1035,7 @@ dump_type_suffix (cxx_pretty_printer *pp, tree t, int flags)
anyway; they may in g++, but we'll just pretend otherwise. */
dump_parameters (pp, arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_cv_qualifiers (pp, type_memfn_quals (t),
TREE_CODE (t) == FUNCTION_TYPE
&& (flags & TFF_POINTER));
@@ -1049,7 +1049,7 @@ dump_type_suffix (cxx_pretty_printer *pp, tree t, int flags)
{
pp_space (pp);
pp_c_attributes_display (pp, TYPE_ATTRIBUTES (t));
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
}
dump_type_suffix (pp, TREE_TYPE (t), flags);
break;
@@ -1720,13 +1720,13 @@ dump_lambda_function (cxx_pretty_printer *pp,
/* Early escape. */;
else if (TREE_CODE (TREE_TYPE (fn)) == FUNCTION_TYPE)
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_c_ws_string (pp, "static");
}
else if (!(TYPE_QUALS (class_of_this_parm (TREE_TYPE (fn)))
& TYPE_QUAL_CONST))
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_c_ws_string (pp, "mutable");
}
dump_substitution (pp, fn, template_parms, template_args, flags);
@@ -1845,20 +1845,20 @@ dump_function_decl (cxx_pretty_printer *pp, tree t, int flags)
if (TREE_CODE (fntype) == METHOD_TYPE)
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_cv_qualifier_seq (pp, class_of_this_parm (fntype));
dump_ref_qualifier (pp, fntype, flags);
}
if (tx_safe_fn_type_p (fntype))
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
pp_cxx_ws_string (pp, "transaction_safe");
}
if (flags & TFF_EXCEPTION_SPECIFICATION)
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
dump_exception_spec (pp, exceptions, flags);
}
@@ -1952,7 +1952,7 @@ dump_ref_qualifier (cxx_pretty_printer *pp, tree t, int flags ATTRIBUTE_UNUSED)
{
if (FUNCTION_REF_QUALIFIED (t))
{
- pp->padding = pp_before;
+ pp->set_padding (pp_before);
if (FUNCTION_RVALUE_QUALIFIED (t))
pp_cxx_ws_string (pp, "&&");
else
@@ -3156,7 +3156,7 @@ static void
reinit_cxx_pp (void)
{
pp_clear_output_area (cxx_pp);
- cxx_pp->padding = pp_none;
+ cxx_pp->set_padding (pp_none);
pp_indentation (cxx_pp) = 0;
pp_needs_newline (cxx_pp) = false;
pp_show_color (cxx_pp) = false;
@@ -3537,7 +3537,7 @@ static const char *
cv_to_string (tree p, int v)
{
reinit_cxx_pp ();
- cxx_pp->padding = v ? pp_before : pp_none;
+ cxx_pp->set_padding (v ? pp_before : pp_none);
pp_cxx_cv_qualifier_seq (cxx_pp, p);
return pp_ggc_formatted_text (cxx_pp);
}
@@ -3682,8 +3682,7 @@ cp_print_error_function (diagnostic_context *context,
pp_newline (context->printer);
diagnostic_set_last_function (context, diagnostic);
- pp_destroy_prefix (context->printer);
- context->printer->prefix = old_prefix;
+ context->printer->set_prefix (old_prefix);
}
}
@@ -4470,9 +4469,9 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
int precision, bool wide, bool set_locus, bool verbose,
bool *quoted, const char **buffer_ptr)
{
- gcc_assert (pp->m_format_postprocessor);
+ gcc_assert (pp_format_postprocessor (pp));
cxx_format_postprocessor *postprocessor
- = static_cast <cxx_format_postprocessor *> (pp->m_format_postprocessor);
+ = static_cast <cxx_format_postprocessor *> (pp_format_postprocessor (pp));
const char *result;
tree t = NULL;