Here's a much less ambitious version of the patch kit, which eliminates any attempt to write to the user's source code (getting rid of edit_context::apply_changes and -fdiagnostics-apply-fixits).
It implements -fdiagnostics-generate-patch. In so doing, it tightens up the exact semantics of fix-its; see [1] for an example of where that's useful. I need review of at least patches 1 and 2 (which are unchanged from v1 of the kit). I believe I can self-approve patches 3 and 4 as part of my "diagnostics maintainer" role; are they acceptable to those who objected to the earlier kit? (now that there's no attempt to write to source files). Successfully bootstrapped®rtested the combination of the patches on x86_64-pc-linux-gnu. OK for trunk? (assuming individual bootstraps®rtesting) [1] https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01751.html David Malcolm (4): selftest: split out named_temp_file from temp_source_file Improvements to typed_splay_tree Introduce class edit_context (v2) Add -fdiagnostics-generate-patch (v2) gcc/Makefile.in | 2 + gcc/common.opt | 4 + gcc/diagnostic-color.c | 8 +- gcc/diagnostic.c | 11 + gcc/diagnostic.h | 6 + gcc/doc/invoke.texi | 23 +- gcc/edit-context.c | 1306 ++++++++++++++++++++ gcc/edit-context.h | 65 + gcc/selftest-run-tests.c | 2 + gcc/selftest.c | 49 +- gcc/selftest.h | 26 +- .../diagnostic-test-show-locus-generate-patch.c | 77 ++ gcc/testsuite/gcc.dg/plugin/plugin.exp | 3 +- gcc/toplev.c | 14 + gcc/typed-splay-tree.c | 79 ++ gcc/typed-splay-tree.h | 67 + 16 files changed, 1718 insertions(+), 24 deletions(-) create mode 100644 gcc/edit-context.c create mode 100644 gcc/edit-context.h create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c create mode 100644 gcc/typed-splay-tree.c -- 1.8.5.3