[sancov] Use LLVM Support library JSON writer in favor of individual implementation
authorVitaly Buka <vitalybuka@google.com>
Sat, 12 Oct 2019 02:29:24 +0000 (02:29 +0000)
committerVitaly Buka <vitalybuka@google.com>
Sat, 12 Oct 2019 02:29:24 +0000 (02:29 +0000)
commite8a462a01923676860ee4d7b0d191043ea4b9f63
tree4a6c0345837eb7dd60739f57b72765096d6d4ca3
parent0bb06f6f667eb174f1cec638fc181f1f32dffb44
[sancov] Use LLVM Support library JSON writer in favor of individual implementation

Summary:
In this diff, I've replaced the individual implementation of `JSONWriter` with `json::OStream` provided by `llvm/Support/JSON.h`.

Important Note: The output format of the JSON is considerably different compared to the original implementation. Important differences include:
* New line for each entry in an array (should make diffs cleaner)
* No space between keys and colon in attributed object entries.
* Attributes with empty strings will now print the attribute name and a quote pair rather than excluding the attribute altogether

Examples of these differences can be seen in the changes to the sancov tests which compare the JSON output.

Patch by Douglas Gliner.

Reviewers: kcc, filcab, phosek, morehouse, vitalybuka, metzman

Subscribers: mehdi_amini, dexonsmith, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D68752

llvm-svn: 374628
llvm/test/tools/sancov/merge.test
llvm/test/tools/sancov/symbolize.test
llvm/test/tools/sancov/symbolize_noskip_dead_files.test
llvm/tools/sancov/sancov.cpp