[PATCH] clang-format fix Mozilla defaults

Daniel Jasper djasper at google.com
Sun Jan 19 23:22:28 PST 2014


Hi,

sending the patch here is correct or you can also try out Phabricator at
http://llvm-reviews.chandlerc.com/ which we use frequently at least for
clang-format related changes.

I have tried to double-check with
https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style and I
don't think all of you changes are correct:

> +  MozillaStyle.BreakConstructorInitializersBeforeComma = true;
> +  MozillaStyle.ConstructorInitializerIndentWidth = 2;

Yep, this seems right (
https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style#Classes
).

> -  MozillaStyle.IndentCaseLabels = true;

I think this is incorrect. In
https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style#Control_Structures,
"case 1", "case 2" and "default" are indented.

> +  MozillaStyle.ContinuationIndentWidth = 2;

This is not obvious from the style guide. A continuation explicitly is not
a logical level so the corresponding paragraph doesn't apply. Specifically,
many source files seems to indent continuations by aligning with the open
parenthesis, which is also not an indentation of 2. Am I missing a section
from the style guide? If not, could we put one in? I am happy to trust you
here as you have probably seen many source files.

> +  MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Linux;

Yep. Looks right (gathered from several sections).

Cheers,
Daniel


On Mon, Jan 20, 2014 at 2:00 AM, Anthony Jones <ajones at mozilla.com> wrote:

> Hi,
>
> This is my first llvm or clang patch so I apologise if I've missed some
> step in the process. Currently clang-format's idea of Mozilla style is
> substantially incorrect. This patch updates the Mozilla default to make
> it more closely match the style used by Mozilla. There is further work
> to do here.
>
> Anthony
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140120/6dd44af4/attachment.html>


More information about the cfe-commits mailing list