[SERVER-66947] Run clang-tidy in parallel Created: 01/Jun/22  Updated: 29/Oct/23  Resolved: 30/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Alex Neben Assignee: Alex Neben
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-65575 convert buildscripts/clang_tidy.sh to... Closed
Backwards Compatibility: Fully Compatible
Sprint: Dev Platform 2022-07-11
Participants:

 Description   

Clang tidy can be made drastically fast if run in parallel. Here is a python script from llvm that we could use.

https://clang.llvm.org/extra/doxygen/run-clang-tidy_8py_source.html



 Comments   
Comment by Alex Neben [ 30/Jun/22 ]

Not really fixed but fixed with https://github.com/10gen/mongo/pull/6012

Comment by Alex Neben [ 15/Jun/22 ]

mark.benvenuto@mongodb.com so I was looking to see if I could use your script from some data collection I currently am doing. As part of that I was hoping to adapt it to use for our clang-tidy since python > bash. However, the problem with that script is that it only runs on clang-tidy files identified in the diff. 

Let us say that dev1 ONLY changed a templated function (functionP) in a headerA.h. However, that change was from

...
delete p
... 

to

...
if (p) { delete p; } 
...

which should trigger https://releases.llvm.org/7.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-delete-null-pointer.html
clang-tidy would only warn about this after someone else changes a file that has an instantiation of functionP.

Now that is not to say it is not a good starting point for me but I just want to message out that this is not a viable way to speed up the commit queue part of clang-tidy. I think the best way is to use icecream (or another distributed execution environment) to run them completely in parallel.

Generated at Thu Feb 08 06:06:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.