[all-commits] [llvm/llvm-project] 0487f6: [clang-format] Fix short block when braking after ...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Sat Jun 13 06:20:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0487f6f19cdaaec81a5e2d6dfce7fd0cd3a9b6ca
      https://github.com/llvm/llvm-project/commit/0487f6f19cdaaec81a5e2d6dfce7fd0cd3a9b6ca
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2020-06-13 (Sat, 13 Jun 2020)

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

  Log Message:
  -----------
  [clang-format] Fix short block when braking after control statement

Summary:
This patch fixes bug #44192

When clang-format is run with option AllowShortBlocksOnASingleLine, it is expected to either succeed in putting the short block with its control statement on a single line or fail and leave the block as is. When brace wrapping after control statement is activated, if the block + the control statement length is superior to column limit but the block alone is not, clang-format puts the block in two lines: one for the control statement and one for the block. This patch removes this unexpected behaviour. Current unittests are updated to check for this behaviour.

Patch By: Bouska

Reviewed By: MyDeveloperDay

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




More information about the All-commits mailing list