[PATCH] D40988: Clang-format: add finer-grained options for putting all arguments on one line
Daniel Jasper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 12 03:36:01 PDT 2018
djasper added inline comments.
================
Comment at: unittests/Format/FormatTest.cpp:3444
+
+ verifyFormat("Constructor()\n"
+ " : aaaaaaaaaaaaaaaaaaaa(a), bbbbbbbbbbbbbbbbbbbbb(b) {}",
----------------
djasper wrote:
> I find these tests hard to read and reason about. How about writing them like this:
>
> for (int i = 0; i < 4; ++i) { // There might be a better way to iterate
> // Test all combinations of parameters that should not have an effect.
> Style.AllowAllParametersOfDeclarationOnNextLine = i & 1;
> Style.AllowAllConstructorInitializersOnNextLine = i & 2;
>
> Style.AllowAllConstructorInitializersOnNextLine = true;
> verifyFormat("SomeClassWithALongName::Constructor(\n"
> " int aaaaaaaaaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbb)\n"
> " : aaaaaaaaaaaaaaaaaaaa(a), bbbbbbbbbbbbbbbbbbbbb(b) {}",
> Style);
> // ... more tests
>
>
> Style.AllowAllConstructorInitializersOnNextLine = false;
> verifyFormat("SomeClassWithALongName::Constructor(\n"
> " int aaaaaaaaaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbb)\n"
> " : aaaaaaaaaaaaaaaaaaaa(a)\n"
> " , bbbbbbbbbbbbbbbbbbbbb(b) {}",
> Style);
> // ... more tests
> }
Err.. The second line inside the for-loop was meant to read:
Style.AllowAllArgumentsOnNextLine = i & 2;
https://reviews.llvm.org/D40988
More information about the cfe-commits
mailing list