emit JSON output from clang-tidy

Greetings!

Exploring ways to emit JSON output from clang-tidy such that it can be cached.

Which is the right place to add/modify code -- (a) in ClangTidyDiagnosticConsumer::finish() [at this point we have filtered diag errors] OR
          (b) ClangTidyContext::diag() [getting invoked on each unfiltered diagnostic error]

From ClangTidyContext, DiagnosticEngine and SourceManager, how to get json tuple {"tidy-checker":<tidy-checker-name>,"file":<source-file-name>,"line":<line#>,"column":<column#> }.

Thank you in advance.
-H

clang-tidy emits YAML if you use -export-fixes=myfile.yaml. If all you want is caching, that should work?

Other than that, if JSON is a hard requirement, you might be done quicker if you find a yaml to json converter.

If you really want to hack it into the code, you could probably do it at the same time as the YAML is generated with the call to clang::tidy::exportReplacements.

Thanks,

Stephen.