r355182 - [clang-format] [NFC] clang-format the Format library

Michael Kruse via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 13:07:34 PDT 2019

Am Sa., 9. März 2019 um 13:54 Uhr schrieb MyDeveloper Day
<mydeveloperday at gmail.com>:
> Yes ideally I'd agree, It also says:
> > Avoid committing formatting- or whitespace-only changes outside of code you plan to make subsequent changes to.
> This was getting to be a problem, every time we edited the file (with auto-clang-format) a large number of other changes would also get made, presumably because others hadn't been clang-formatting their commits correctly! we'd have to merge out a lot of changes everytime.

This is the same motivation behind r338291 which motivated adding this
developer policy (see

I use "git clang-format origin/master" to only reformat lines that I touched.

> >Also, try to separate formatting or whitespace changes from functional changes, either by correcting the format first (ideally) or afterward
> which means you want those changes to be separate commits.. so ideally its better we clang-format the file when there is no other related changes so future revisions don't need to have a mixture of real changes and whitespace changes.

The policy wants only those parts you are going to change to be
re-formatted, up to complete files (I've seen those sometimes), not
entire components.

> I also think given we also encourage people to clang-format out code,  its ironic clang-format itself is not clang-formatted!

This should be pointed-out in reviews. Unfortunately, things will
always slip through. Also, clang-format changes over time, i.e. we
would have to reformat regularly anyway.


More information about the cfe-commits mailing list