]> granicus.if.org Git - clang/commit
clang-format: Improve column layout.
authorDaniel Jasper <djasper@google.com>
Mon, 11 May 2015 13:35:40 +0000 (13:35 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 11 May 2015 13:35:40 +0000 (13:35 +0000)
commit75557a85f8e6d7d795405cf1a4b20a528e78a75e
tree7faaad79caa0f4fbee1e57ad4c99013b71802017
parentd775e3645631761b899221b78000d5776cfe10bd
clang-format: Improve column layout.

Specifically, calculate the deviation between the shortest and longest
element (which is used to prevent excessive whitespace) per column, not
overall. This automatically handles the corner cases of a single column
and a single row so that the actualy implementation becomes simpler.

Before:
  vector<int> x = {1,
                   aaaaaaaaaaaaaaaaaaaaaa,
                   2,
                   bbbbbbbbbbbbbbbbbbbbbb,
                   3,
                   cccccccccccccccccccccc};

After:
  vector<int> x = {1, aaaaaaaaaaaaaaaaaaaaaa,
                   2, bbbbbbbbbbbbbbbbbbbbbb,
                   3, cccccccccccccccccccccc};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236992 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/FormatToken.cpp
unittests/Format/FormatTest.cpp