[all-commits] [llvm/llvm-project] 0ee04e: [clang-format] Fix AlignOperands when BreakBeforeB...

Typz via All-commits all-commits at lists.llvm.org
Fri May 15 07:40:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ee04e6e0d0e1c808dc6c70ff7b92b35f960b627
      https://github.com/llvm/llvm-project/commit/0ee04e6e0d0e1c808dc6c70ff7b92b35f960b627
  Author: Francois Ferrand <thetypz at gmail.com>
  Date:   2020-05-15 (Fri, 15 May 2020)

  Changed paths:
    M clang/docs/ClangFormatStyleOptions.rst
    M clang/include/clang/Format/Format.h
    M clang/lib/Format/ContinuationIndenter.cpp
    M clang/lib/Format/ContinuationIndenter.h
    M clang/lib/Format/Format.cpp
    M clang/unittests/Format/FormatTest.cpp
    M clang/unittests/Format/FormatTestJS.cpp

  Log Message:
  -----------
  [clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set

Summary:
Even when BreakBeforeBinaryOperators is set, AlignOperands kept
aligning the beginning of the line, even when it could align the
actual operands (e.g. after an assignment).

With this patch, the operands are actually aligned, and the operator
gets aligned with the equal sign:

  int aaaaa = bbbbbb
            + cccccc;

This not happen in tests, to avoid 'breaking' the indentation:

  if (aaaaa
      && bbbbb)
    return;

Reviewers: krasimir, djasper, klimek, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, acoomans, cfe-commits, klimek

Tags: #clang, #clang-format

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




More information about the All-commits mailing list