[PATCH] D79325: [clang-format] [PR42164] Add Option to Break before While
Krasimir Georgiev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 12 14:00:05 PDT 2020
krasimir added inline comments.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2170
parseBlock(/*MustBeDeclaration=*/false);
- if (Style.BraceWrapping.IndentBraces)
+ if (Style.BraceWrapping.IndentBraces || Style.BraceWrapping.BeforeWhile)
addUnwrappedLine();
----------------
MyDeveloperDay wrote:
> krasimir wrote:
> > Why not remove `Style.BraceWrapping.IndentBraces`?
> > - should be a no-op for GNU style,
> > - other styles don't IndentBraces,
> > - we can add a sentence in the release notes that previously IndentBraces implied the new "BeforeWhile" option, and now you just have to set it if you're using a custom GNU-like style.
> `IndentBraces` is used elsewhere inside parseLabel() and CompoundStatementIndenter, I think I'd be uncomfortable about removing it.
>
> There are 1000's of references to it in GitHub.
>
> https://github.com/search?l=YAML&q=%22IndentBraces%3A+true%22&type=Code
>
> https://github.com/search?q=%22IndentBraces%3A+false%22&type=Code
I'm sorry, I wasn't clear: why not remove `Style.BraceWrapping.IndentBraces || ` from line 2170, leaving the value of the new option `Style.BraceWrapping.BeforeWhile` be the only thing that determines whether a newline is added before the `while` in a do-while block?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79325/new/
https://reviews.llvm.org/D79325
More information about the cfe-commits
mailing list