Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

BraceWrapping.AfterControlStatement=Multiline breaks AllowShortFunctionsOnASingleLine setting #51556

Closed Quuxplusone closed 2 years ago

Quuxplusone commented 2 years ago
Bugzilla Link PR52589
Status RESOLVED DUPLICATE of bug 47936
Importance P enhancement
Reported by Kyrylo Bohdanenko (kyrylo.bohdanenko@gmail.com)
Reported on 2021-11-23 04:30:51 -0800
Last modified on 2021-11-24 01:55:30 -0800
Version 13.0
Hardware PC Linux
CC djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Consider the following C++ source file (test.cpp):

int theAnswer() { return 42; }

And the following clang-format configuration (.clang-format):

  Language: Cpp
  BreakBeforeBraces: Custom
  BraceWrapping:
    AfterFunction: true
    AfterControlStatement: MultiLine
  AllowShortFunctionsOnASingleLine: All

Note: this configuration is supposed to wrap the opening curly brace for non-
trivial-functions but allow for one-liners.

Then run clang-format like this:

clang-format -style=file test.cpp

Produced output:

int theAnswer()
{
  return 42;
}

Expected output: <same as input>
Quuxplusone commented 2 years ago

_This bug has been marked as a duplicate of bug 47936_