clang-power-tools icon indicating copy to clipboard operation
clang-power-tools copied to clipboard

Parallel execution of Clang-Tidy over a project

Open Philippe91 opened this issue 4 years ago • 3 comments

When running clang-tidy over a project, why not running multiple tasks in parallel?

Philippe91 avatar Nov 15 '20 10:11 Philippe91

Hi @Philippe91

When we first implemented parallelism for our PowerShell workers, we actually did have support for tidy as well. However, we encountered issues when fixing headers, because on ocassion two or more translation units would cause the same header to be fixed, at the same time. This concurrency problem ended up corrupting the headers.

We decided to remove -parallel support for tidy workflows because of the header corruption issues.

If a solution can be found for that, we would be more than happy to reintroduce -parallel support for tidy workflows.

Regards, Gabriel

hero101111 avatar Nov 15 '20 10:11 hero101111

Did you consider running clang-tidy first, without fixes, and then to use the LLVM tool "clang-apply-replacements.exe" at the end, in a single thread?

https://devblogs.microsoft.com/cppblog/exploring-clang-tooling-using-build-tools-with-clang-tidy/#lightbox-custom

Philippe91 avatar Nov 15 '20 11:11 Philippe91

We did not consider clang-apply-replacements at the time. Looks very promising, in that it would help solve our parallelism problems.

We will definitely make use of it in a future release of Clang Power Tools.

Thank you for bringing it to our attention.

hero101111 avatar Nov 15 '20 12:11 hero101111