Fix incorrect recognition of bin-packing.

Before (in Google style):
Constructor()
    : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(
          aaaaaa) {}

After:
Constructor()
    : aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176242 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Jasper 2013-02-28 09:39:12 +00:00
Родитель 807809c421
Коммит 3a39ac7cee
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -654,7 +654,8 @@ private:
AvoidBinPacking = false;
} else {
NewIndent = 4 + State.Stack.back().LastSpace;
AvoidBinPacking = !Style.BinPackParameters;
AvoidBinPacking =
!Style.BinPackParameters || State.Stack.back().AvoidBinPacking;
}
State.Stack.push_back(
ParenState(NewIndent, State.Stack.back().LastSpace, AvoidBinPacking,

Просмотреть файл

@ -1173,6 +1173,13 @@ TEST_F(FormatTest, ConstructorInitializers) {
" some_other_var_(var + 1) { // lined up\n"
"}",
OnePerLine);
verifyFormat("Constructor()\n"
" : aaaaa(aaaaaa),\n"
" aaaaa(aaaaaa),\n"
" aaaaa(aaaaaa),\n"
" aaaaa(aaaaaa),\n"
" aaaaa(aaaaaa) {}",
OnePerLine);
// This test takes VERY long when memoization is broken.
OnePerLine.BinPackParameters = false;