]> granicus.if.org Git - clang/commit
clang-format: Be more conservative about specially indenting blocks in C++.
authorDaniel Jasper <djasper@google.com>
Fri, 21 Aug 2015 11:44:57 +0000 (11:44 +0000)
committerDaniel Jasper <djasper@google.com>
Fri, 21 Aug 2015 11:44:57 +0000 (11:44 +0000)
commit05ed87540cdd5a2f8cd1bef316a54686f42cf9b3
tree55405e2568a7db45ed80a5d751aaa581b7dd4f21
parent3d633758e800ee0af90f60dcd5a892d1feffd140
clang-format: Be more conservative about specially indenting blocks in C++.

This is a bit of a step back of what we did in r222531, as there are
some corner cases in C++, where this kind of formatting is really bad.

Example:
Before:
  virtual aaaaaaaaaaaaaaaa(std::function<bool()> IsKindWeWant = [&]() {
    return true;
  }, aaaaa aaaaaaaaa);

After:
  virtual aaaaaaaaaaaaaaaa(std::function<bool()> IsKindWeWant =
                               [&]() { return true; },
                           aaaaa aaaaaaaaa);

The block formatting logic in JavaScript will probably go some other changes,
too, and we'll potentially be able to make the rules more consistent again. For
now, this seems to be the best approach for C++.

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