r225141 - clang-format: [Java] Change a few flags for Google's Java style.

Nico Weber thakis at chromium.org
Sun Jan 4 12:44:02 PST 2015


We (chromium) definitely want AllowShortIfStatementsOnASingleLine true
since https://source.android.com/source/code-style.html explicitly allows
this, but if Google style doesn't want AlignTrailingComments for Java I'd
guess we don't want that either.

On Sun, Jan 4, 2015 at 12:40 PM, Daniel Jasper <djasper at google.com> wrote:

> Author: djasper
> Date: Sun Jan  4 14:40:45 2015
> New Revision: 225141
>
> URL: http://llvm.org/viewvc/llvm-project?rev=225141&view=rev
> Log:
> clang-format: [Java] Change a few flags for Google's Java style.
>
> No tests added as all of these are already tested separately.
>
> Modified:
>     cfe/trunk/lib/Format/Format.cpp
>
> Modified: cfe/trunk/lib/Format/Format.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=225141&r1=225140&r2=225141&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Format/Format.cpp (original)
> +++ cfe/trunk/lib/Format/Format.cpp Sun Jan  4 14:40:45 2015
> @@ -419,7 +419,9 @@ FormatStyle getGoogleStyle(FormatStyle::
>    if (Language == FormatStyle::LK_Java) {
>      GoogleStyle.AlignAfterOpenBracket = false;
>      GoogleStyle.AlignOperands = false;
> +    GoogleStyle.AlignTrailingComments = false;
>      GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
> +    GoogleStyle.AllowShortIfStatementsOnASingleLine = false;
>      GoogleStyle.BreakBeforeBinaryOperators =
> FormatStyle::BOS_NonAssignment;
>      GoogleStyle.ColumnLimit = 100;
>      GoogleStyle.SpaceAfterCStyleCast = true;
> @@ -440,6 +442,8 @@ FormatStyle getGoogleStyle(FormatStyle::
>  FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language) {
>    FormatStyle ChromiumStyle = getGoogleStyle(Language);
>    if (Language == FormatStyle::LK_Java) {
> +    ChromiumStyle.AlignTrailingComments = true;
> +    ChromiumStyle.AllowShortIfStatementsOnASingleLine = true;
>      ChromiumStyle.IndentWidth = 4;
>      ChromiumStyle.ContinuationIndentWidth = 8;
>    } else {
>
>
> _______________________________________________
> 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/20150104/ba14435e/attachment.html>


More information about the cfe-commits mailing list