r176242 - Fix incorrect recognition of bin-packing.
Daniel Jasper
djasper at google.com
Thu Feb 28 01:39:13 PST 2013
Author: djasper
Date: Thu Feb 28 03:39:12 2013
New Revision: 176242
URL: http://llvm.org/viewvc/llvm-project?rev=176242&view=rev
Log:
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) {}
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=176242&r1=176241&r2=176242&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Feb 28 03:39:12 2013
@@ -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,
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=176242&r1=176241&r2=176242&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Feb 28 03:39:12 2013
@@ -1173,6 +1173,13 @@ TEST_F(FormatTest, ConstructorInitialize
" 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;
More information about the cfe-commits
mailing list