diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-20 21:49:12 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-20 21:49:12 +0000 |
commit | c9c81ef3c667aaa14c498a5449ec6d134b4b66ff (patch) | |
tree | 0ac440db6513ee01deb5e5dc6142769d1e5b7b2d /gcc/diagnostic.c | |
parent | 12cdcb9d74f55c165366ca1b1eeec013a0ce72ef (diff) | |
parent | 891196d7325e4c55d92d5ac5cfe7161c4f36c0ce (diff) | |
download | gcc-fortran-dev.tar.gz |
Merge from trunk (r239915 to r240230)fortran-dev
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/fortran-dev@240290 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r-- | gcc/diagnostic.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 47b4c79ebcc..585028ec211 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "backtrace.h" #include "diagnostic.h" #include "diagnostic-color.h" +#include "edit-context.h" #include "selftest.h" #ifdef HAVE_TERMIOS_H @@ -174,6 +175,7 @@ diagnostic_initialize (diagnostic_context *context, int n_opts) context->colorize_source_p = false; context->show_ruler_p = false; context->parseable_fixits_p = false; + context->edit_context_ptr = NULL; } /* Maybe initialize the color support. We require clients to do this @@ -235,6 +237,12 @@ diagnostic_finish (diagnostic_context *context) context->printer->~pretty_printer (); XDELETE (context->printer); context->printer = NULL; + + if (context->edit_context_ptr) + { + delete context->edit_context_ptr; + context->edit_context_ptr = NULL; + } } /* Initialize DIAGNOSTIC, where the message MSG has already been @@ -943,6 +951,9 @@ diagnostic_report_diagnostic (diagnostic_context *context, diagnostic->message.format_spec = saved_format_spec; diagnostic->x_data = NULL; + if (context->edit_context_ptr) + context->edit_context_ptr->add_fixits (diagnostic->richloc); + context->lock--; return true; @@ -1493,7 +1504,7 @@ test_print_parseable_fixits_insert () linemap_line_start (line_table, 5, 100); linemap_add (line_table, LC_LEAVE, false, NULL, 0); location_t where = linemap_position_for_column (line_table, 10); - richloc.add_fixit_insert (where, "added content"); + richloc.add_fixit_insert_before (where, "added content"); print_parseable_fixits (&pp, &richloc); ASSERT_STREQ ("fix-it:\"test.c\":{5:10-5:10}:\"added content\"\n", |