[PATCH] D54141: [clang-tidy] add deduplication support for run-clang-tidy.py

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 6 08:18:34 PST 2018


steveire added a comment.

This feature seems like a good idea. I started writing it too some months ago, but then I changed tactic and worked on distributing the refactor over the network instead. As far as I know, your deduplication would not work with a distributed environment.

However, it seems that both features can exist.

You use a regex to parse the clang output. Why not use the already-machine-readable yaml output and de-duplicate based on that? I think the design would be something like:

- Run clang-tidy in a quiet mode which only exports yaml and does not issue diagnostics
- Read the yaml in your python script
- Add the entries to your already-seen cache
- For any entry which was not already there
  - Write the entries to a new yaml file
  - Use clang-apply-replacements --issue-diags the_new_file.yaml to actually cause the new diagnostics to be issued (they were omitted from the clang-tidy run).

This avoids fragile parsing of the output from clang, instead relying on the machine-readable format.

I think clang-apply-replacements already does de-duplication, so it's possible that could take more responsibility.

Also, I think your test content is too big. I suggest trying to write more contained tests for this.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54141





More information about the cfe-commits mailing list