[all-commits] [llvm/llvm-project] d45aaf: [clang-format] fix conflict between FormatStyle::B...

mitchell-stellar via All-commits all-commits at lists.llvm.org
Mon Jan 6 06:22:36 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d45aafa2fbcf66f3dafdc7c5e0a0ce3709914cbc
      https://github.com/llvm/llvm-project/commit/d45aafa2fbcf66f3dafdc7c5e0a0ce3709914cbc
  Author: Mitchell Balan <mitchell at stellarscience.com>
  Date:   2020-01-06 (Mon, 06 Jan 2020)

  Changed paths:
    M clang/lib/Format/UnwrappedLineFormatter.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] fix conflict between FormatStyle::BWACS_MultiLine and BeforeCatch/BeforeElse

Summary:
Found a bug introduced with BraceWrappingFlags AfterControlStatement MultiLine. This feature conflicts with the existing BeforeCatch and BeforeElse flags.

For example, our team uses BeforeElse.

if (foo ||
    bar) {
  doSomething();
}
else {
  doSomethingElse();
}

If we enable MultiLine (which we'd really love to do) we expect it to work like this:

if (foo ||
    bar)
{
  doSomething();
}
else {
  doSomethingElse();
}

What we actually get is:

if (foo ||
    bar)
{
  doSomething();
}
else
{
  doSomethingElse();
}

Reviewers: MyDeveloperDay, Bouska, mitchell-stellar

Patch by: pastey

Subscribers: Bouska, cfe-commits

Tags: clang

Differential Revision: https://reviews.llvm.org/D71939




More information about the All-commits mailing list