No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-5167-ga526cc6ff32e22.
gcc/ChangeLog: * diagnostic.cc (diagnostic_context::set_urlifier): New. * diagnostic.h (diagnostic_context::set_urlifier): New decl. (diagnostic_context::m_urlifier): Make private. * gcc.cc (driver::global_initializations): Use set_urlifier rather than directly setting field. * toplev.cc (general_init): Likewise. --- gcc/diagnostic.cc | 8 ++++++++ gcc/diagnostic.h | 3 +++ gcc/gcc.cc | 2 +- gcc/toplev.cc | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 90103e150f7..c617b34f02b 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -373,6 +373,14 @@ diagnostic_context::set_client_data_hooks (diagnostic_client_data_hooks *hooks) m_client_data_hooks = hooks; } +void +diagnostic_context::set_urlifier (urlifier *urlifier) +{ + /* Ideally we'd use a std::unique_ptr here. */ + delete m_urlifier; + m_urlifier = urlifier; +} + void diagnostic_context::create_edit_context () { diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 4ef031b5d1c..f9950ec2cf8 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -297,6 +297,7 @@ public: void set_output_format (diagnostic_output_format *output_format); void set_text_art_charset (enum diagnostic_text_art_charset charset); void set_client_data_hooks (diagnostic_client_data_hooks *hooks); + void set_urlifier (urlifier *); void create_edit_context (); void set_warning_as_error_requested (bool val) { @@ -518,10 +519,12 @@ public: particular option. */ char *(*m_get_option_url) (diagnostic_context *, int); +private: /* An optional hook for adding URLs to quoted text strings in diagnostics. Only used for the main diagnostic message. */ urlifier *m_urlifier; +public: void (*m_print_path) (diagnostic_context *, const diagnostic_path *); json::value *(*m_make_json_for_path) (diagnostic_context *, const diagnostic_path *); diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 02464958f36..51120c1489e 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -8292,7 +8292,7 @@ driver::global_initializations () diagnostic_initialize (global_dc, 0); diagnostic_color_init (global_dc); diagnostic_urls_init (global_dc); - global_dc->m_urlifier = make_gcc_urlifier (); + global_dc->set_urlifier (make_gcc_urlifier ()); #ifdef GCC_DRIVER_HOST_INITIALIZATION /* Perform host dependent initialization when needed. */ diff --git a/gcc/toplev.cc b/gcc/toplev.cc index e39162a3e49..d8e8978dd55 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -1049,7 +1049,7 @@ general_init (const char *argv0, bool init_signals) global_dc->m_option_state = &global_options; global_dc->m_option_name = option_name; global_dc->m_get_option_url = get_option_url; - global_dc->m_urlifier = make_gcc_urlifier (); + global_dc->set_urlifier (make_gcc_urlifier ()); if (init_signals) { -- 2.26.3