[all-commits] [llvm/llvm-project] 7ad60f: [clang-format] fix BreakBeforeBraces.MultiLine wit...

mitchell-stellar via All-commits all-commits at lists.llvm.org
Wed Aug 5 11:32:21 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ad60f6452ff483912776ef6eda4e28c60d9da6e
      https://github.com/llvm/llvm-project/commit/7ad60f6452ff483912776ef6eda4e28c60d9da6e
  Author: Mitchell Balan <mitchell at stellarscience.com>
  Date:   2020-08-05 (Wed, 05 Aug 2020)

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

  Log Message:
  -----------
  [clang-format] fix BreakBeforeBraces.MultiLine with for each macros
Summary:
The MultiLine option in BreakBeforeBraces was only handling standard
control statement, leading to invalid indentation with for each macros:

Previous behavior:

/* invalid: brace should be on the same line */
Q_FOREACH(int a; list)
{
    foo();
}

/* valid */
Q_FOREACH(int longVariable;
          list)
{
    foo();
}

To fix this, simply add the TT_ForEachMacro kind in the list of
recognized control statements for the multiline option.

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=44632

Reviewers: MyDeveloperDay, mitchell-stellar

Reviewed by: mitchell-stellar

Contributed by: vthib

Subscribers: cfe-commits

Tags: #clang, #clang-format, #clang-tools-extra

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




More information about the All-commits mailing list