emit JSON output from clang-tidy

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

emit JSON output from clang-tidy

via cfe-dev
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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: emit JSON output from clang-tidy

via cfe-dev
On 25/10/2018 10:40, Oza, Hiral via cfe-dev wrote:

> 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.

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.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev