I have been doing some testing with clang-format and formatting only the
lines that have been modified.

Version 3.5 is good enough for Mozilla style although the defaults for
style=Mozilla need to be corrected. It doesn't handle weird cases like
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN and _END blocks.

To try it out, all you need to do is add the "Add a clang-format-diff
helper to mach;" patch from bug 952379 to the head of your patch queue.
It will download clang-format and clang-format-diff for you. I have
built the binary on Ubuntu 64 so let me know if it's broken on other 64
bit Linuxes.

The workflow looks like this:
$ hg qrefresh
$ mach clang-format
<shows changes>

This reformats only the lines that are different from tip^. If you're
happy with the changes then you do:
$ hg qrefresh
$ hg bzexport ...

Otherwise you do:
$ hg revert --all

I've also added a file called .clang-format-ignore which lists
directories to exclude from the "mach clang-format" command. This
currently lsits js/ and mfbt/.

Anthony

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to