HomePhabricator

clang-format: Introduce stricter AlignOperands flag

Authored by Typz on May 22 2017, 2:23 AM.

Description

clang-format: Introduce stricter AlignOperands flag

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, there is an option to actually align the operands, so
that the operator gets right-aligned with the equal sign or return
operator:

int aaaaa = bbbbbb
          + cccccc;
return aaaaaaa
    && bbbbbbb;

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

if (aaaaa
    && bbbbb)
  return;

Reviewers: krasimir, djasper

Subscribers: cfe-commits, klimek

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