aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-09-02 19:41:17 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-09-02 19:41:17 +0000
commit717ebe91c97c37f92ffb5a80a68eb1f6a965fce0 (patch)
tree1c48b3da48c0d917939aeb557e3ff941f07bf978 /gcc/diagnostic.h
parent9dc5773f4b529dd0fefffaf2a2bf9b9ff0195edd (diff)
downloadgcc-717ebe91c97c37f92ffb5a80a68eb1f6a965fce0.zip
gcc-717ebe91c97c37f92ffb5a80a68eb1f6a965fce0.tar.gz
gcc-717ebe91c97c37f92ffb5a80a68eb1f6a965fce0.tar.bz2
Add -fdiagnostics-generate-patch
gcc/ChangeLog: * common.opt (fdiagnostics-generate-patch): New option. * diagnostic.c: Include "edit-context.h". (diagnostic_initialize): Initialize context->edit_context_ptr. (diagnostic_finish): Delete context->edit_context_ptr. (diagnostic_report_diagnostic): Add fix-it hints from the diagnostic to context->edit_context_ptr, if any. * diagnostic.h (class edit_context): Add forward decl. (struct diagnostic_context): Add field "edit_context_ptr". * doc/invoke.texi (Diagnostic Message Formatting Options): Add -fdiagnostics-generate-patch. (-fdiagnostics-generate-patch): New item. * toplev.c: Include "edit-context.h". (process_options): Set global_dc->edit_context_ptr to a new edit_context if the options need one. (toplev::main): Handle -fdiagnostics-generate-patch by using global_dc->edit_context_ptr. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c: New test case. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add diagnostic-test-show-locus-generate-patch.c to the sources for diagnostic_plugin_test_show_locus.c. From-SVN: r239965
Diffstat (limited to 'gcc/diagnostic.h')
-rw-r--r--gcc/diagnostic.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 0727644..ead4d2a 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -62,6 +62,8 @@ typedef void (*diagnostic_start_span_fn) (diagnostic_context *,
typedef diagnostic_starter_fn diagnostic_finalizer_fn;
+class edit_context;
+
/* This data structure bundles altogether any information relevant to
the context of a diagnostic message. */
struct diagnostic_context
@@ -209,6 +211,10 @@ struct diagnostic_context
/* If true, print fixits in machine-parseable form after the
rest of the diagnostic. */
bool parseable_fixits_p;
+
+ /* If non-NULL, an edit_context to which fix-it hints should be
+ applied, for generating patches. */
+ edit_context *edit_context_ptr;
};
static inline void