[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set
authorFrancois Ferrand <thetypz@gmail.com>
Mon, 22 May 2017 09:23:08 +0000 (11:23 +0200)
committerFrancois Ferrand <francois.ferrand@faurecia.com>
Fri, 15 May 2020 14:40:31 +0000 (16:40 +0200)
commit0ee04e6e0d0e1c808dc6c70ff7b92b35f960b627
treeb2962122bba912611be937586f6666936e2fa39e
parent4db94094b469b4715d08ef37f1799bf3ea7ca8ea
[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
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h
clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/ContinuationIndenter.h
clang/lib/Format/Format.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/FormatTestJS.cpp