clang-format: Slightly change indentation rules in for loops.
authorDaniel Jasper <djasper@google.com>
Fri, 6 Mar 2015 10:57:12 +0000 (10:57 +0000)
committerDaniel Jasper <djasper@google.com>
Fri, 6 Mar 2015 10:57:12 +0000 (10:57 +0000)
commit98f8ae34da229b16a59953731651c0b37933b74c
treedcef8ca2d2e2c3500ea256510c24d83505bf7d83
parent78521ef545bbf6c6aba29368fb011e1280f3541d
clang-format: Slightly change indentation rules in for loops.

There was already a TODO to double-check whether the extra indenation
makes sense. A slightly different case reveals that it is actively harmful:

  for (int i = 0; i < aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ||
                      bbbbbbbbbbbbbbbbbbbb < ccccccccccccccc;
       ++i) {
  }

Here (and it is probably not a totally infrequent case, it just works out that
"i < " is four spaces and so the four space extra indentation makes the
operator precedence confusing. So, this will now instead be formatted
as:

  for (int i = 0; i < aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ||
                  bbbbbbbbbbbbbbbbbbbb < ccccccccccccccc;
       ++i) {
  }

llvm-svn: 231461
clang/lib/Format/ContinuationIndenter.cpp
clang/unittests/Format/FormatTest.cpp