Add a flag to emit error messages as JSON
authorMatthew Pickering <matthewtpickering@gmail.com>
Mon, 30 Jan 2017 16:53:17 +0000 (11:53 -0500)
committerBen Gamari <ben@smart-cactus.org>
Mon, 30 Jan 2017 19:00:23 +0000 (14:00 -0500)
commit91691117fc194c525f58ccd5b266dd1d10493e5a
treec9fd4334d5bb2441ad4c75a57697cd80462f492e
parent7363d5380e600e2ef868a069d5df6857d9e5c17e
Add a flag to emit error messages as JSON

This patch adds the flag `-ddump-json` which dumps all the compiler
output as a JSON array. This allows tooling to more easily parse GHC's
output to display to users.

The flag is currently experimental and will hopefully be refined for the
next release.  In particular I have avoided any changes which involve
significant refactoring and provided what is easy given the current
infrastructure.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: DanielG, gracjan, thomie

Differential Revision: https://phabricator.haskell.org/D3010

GHC Trac Issues: #13190
16 files changed:
compiler/basicTypes/SrcLoc.hs
compiler/ghc.cabal.in
compiler/ghc.mk
compiler/main/DynFlags.hs
compiler/main/DynFlags.hs-boot
compiler/main/ErrUtils.hs
compiler/main/ErrUtils.hs-boot
compiler/main/GHC.hs
compiler/utils/Json.hs [new file with mode: 0644]
docs/users_guide/8.2.1-notes.rst
docs/users_guide/debugging.rst
testsuite/tests/driver/all.T
testsuite/tests/driver/json.hs [new file with mode: 0644]
testsuite/tests/driver/json.stderr [new file with mode: 0644]
testsuite/tests/driver/json2.hs [new file with mode: 0644]
testsuite/tests/driver/json2.stderr [new file with mode: 0644]