[llvm-dev] Widescale clang-tidy (or similar) based cleanup

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 7 15:05:13 PDT 2017


There have been some efforts recently to use clang-tidy or similar
automated refactoring to make project-wide cleanups/improvements to the
LLVM codebase that appear to me to be a bit out of character with the sort
of changes & philosophies that have been applied in the past.

I think there are a few issues at hand which I'll try to summarize:

* Churn/blame-convenience:
Previously, large scale changes (classically whitespace cleanup, with
things like clang-format) have been rejected or discouraged due to the risk
of making it harder to find the original source of a semantic change.
I'm not too wedded to this issue myself, but it did seem to be the
status-quo previously so I'm curious to better understand if/how people see
this applying or not, to more semantic changes.

* Efficiency:
Sending individual or even batched reviews for automated changes like this
seems inefficient. I'd rather see, for example, an email to llvm-dev to
discuss whether a particular change makes sense to make across the project
(ie: does the LLVM project want to cleanup all instances of classic for to
range-based-for when clang-tidy can do so?) and then not send the
individual changes for review, but commit them directly where possible. (if
the person doing this automated cleanup doesn't have permission, yeah, send
it out and reference the original discussion thread).

Some points of comparison: sometimes there's similar cleanup done in a
non-automated fashion as Mehdi pointed out in one of the threads I brought
this up (see this thread:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170403/443547.html
).
Usually some amount of cleanup has been acceptable if the code was
generally being churned anyway (eg: clang-formatting a file so it's
consistent, before doing major surgery to it anyway, so the surgical
changes don't create formatting inconsistencies), or as a result of a new
API change (add a range-based accessor then fix up existing call sites to
use range-based-for). I'd also not be surprised by a whitespace cleanup
shortly after new code was committed - and have done this myself "oops,
forgot to format my commit, here's a new commit that does the formatting".
That seems different to me from these wider-scale cleanups.

I think I'm personally mostly in favor of this sort of stuff (though I
think I would like some community buy-in to sign off project-wide on each
clang-tidy rule/pattern/etc that's going to be applied) but it does seem
new/different from the way some things have been done in the past so I'm
curious how other people think about the differences/similarities/guiding
principles.

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170407/5b6b8fed/attachment.html>


More information about the llvm-dev mailing list