[PATCH] D114521: [clang-format] [PR47936] AfterControlStatement: MultiLine breaks AllowShortFunctionsOnASingleLine

2021-11-24 Thread Kyrylo Bohdanenko via Phabricator via cfe-commits
KyrBoh added a comment.

@MyDeveloperDay

> What it seems is "AllowShortIfStatementsOnASingleLine" ONLY seems to work 
> when there are no {}

AFAIR, there are 2 settings (in case of control statements):

- AllowShortBlocksOnASingleLine --> whether to treat (curly-)braced blocks as a 
single statement (i.e. allow them be one-liners)
- AllowShortIfStatementsOnASingleLine --> this actually tells whether control 
statements *can* be one-liners

So these two should be considered in pair. BTW, the documentation for 
AllowShortIfStatementsOnASingleLine seems to be a bit misleading

@curdeius 
Alright, I'll create a report


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114521/new/

https://reviews.llvm.org/D114521

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114521: [clang-format] [PR47936] AfterControlStatement: MultiLine breaks AllowShortFunctionsOnASingleLine

2021-11-24 Thread Kyrylo Bohdanenko via Phabricator via cfe-commits
KyrBoh added a comment.

In D114521#3151431 , @curdeius wrote:

> LGTM, but I have one question. You mentioned in the bug ticket comment that 
> "this exposes a greater issue in AllowShortXXX". Have you found other cases 
> that misbehave? If so, then it would probably be good to add them.

There also seems to be a behavior caused by AfterControlStatement = Multiline. 
This code:

if (condition) { contrinue; }

Is broken up into lines:

if (condition)
{

  continue;

}

I am not sure if this is intended behavior or not.

Because when having this configuration:

BreakBeforeBraces: Custom
BraceWrapping:

  AfterControlStatement: Never

AllowShortBlocksOnASingleLine: Always
AllowShortIfStatementsOnASingleLine: WithoutElse # any value except Never

clang-format would leave that code unchanged.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114521/new/

https://reviews.llvm.org/D114521

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits