[PATCH] D43290: clang-format: tweak formatting of variable initialization blocks

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 14 09:33:11 PST 2018


djasper added a comment.

What you are doing makes sense to me. My only hesitation is whether we should maybe completely disallow breaking between = and { when Cpp11BracedListStyle is false instead of solving this via penalties. Specifically,

                                             | 80 column limit
  SomethingReallyLong<SomethingReallyLong> =
      { { a, b, c },
        { a, b, c } };

Might not be as good as

                                             | 80 column limit
  SomethingReallyLong<
      SomethingReallyLong> = {
    { a, b, c },
    { a, b, c }
  };

in this mode.



================
Comment at: unittests/Format/FormatTest.cpp:6889
+  // Do not break between equal and opening brace.
+  FormatStyle avoidBreakingFirstArgument = getLLVMStyleWithColumns(43);
+  avoidBreakingFirstArgument.PenaltyBreakBeforeFirstCallParameter = 200;
----------------
Upper camel case for variable names according to LLVM style.


Repository:
  rC Clang

https://reviews.llvm.org/D43290





More information about the cfe-commits mailing list