summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-25 15:43:32 +0000
committerDaniel Jasper <djasper@google.com>2013-01-25 15:43:32 +0000
commit7a31af140b3a7beada378700a4795e38dd886188 (patch)
tree9e7561664b4abde25650f83b10d53b5b1fcf2fca /clang/unittests/Format/FormatTest.cpp
parent0e5becb8302ec6838eb8d31ab3b74f226ce54133 (diff)
downloadbcm5719-llvm-7a31af140b3a7beada378700a4795e38dd886188.tar.gz
bcm5719-llvm-7a31af140b3a7beada378700a4795e38dd886188.zip
Fix some alignment and line break decisions.
This combines two small changes: 1) Put a penalty on breaking after "<" 2) Only produce a hanging indent when parameters are separated by commas. Before: aaaaaaaaaaaaaaaaaaaaaaaa< aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)); After: aaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)); This changes one ObjC test, but AFAICT this is not according to any style guide (neither before nor after). We probably should be aligning on the ":" there according to: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml?showone=Method_Invocations#Method_Invocations llvm-svn: 173457
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 2250c03b583..7d274832a30 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -909,7 +909,7 @@ TEST_F(FormatTest, ConstructorInitializers) {
// This test takes VERY long when memoization is broken.
std::string input = "Constructor()\n"
- " : aaaa(a,\n";
+ " : aaaa(a,\n";
for (unsigned i = 0, e = 80; i != e; ++i) {
input += " a,\n";
}
@@ -952,6 +952,12 @@ TEST_F(FormatTest, BreaksDesireably) {
verifyFormat(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
+ verifyFormat(
+ "aaaaaa(new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaa));");
+ verifyFormat(
+ "aaaaaa(aaa, new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaa));");
// This test case breaks on an incorrect memoization, i.e. an optimization not
// taking into account the StopAt value.
@@ -1202,6 +1208,9 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) {
"template <typename T1, typename T2 = char, typename T3 = char,\n"
" typename T4 = char>\n"
"void f();");
+ verifyFormat(
+ "aaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa>(\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
}
TEST_F(FormatTest, WrapsAtNestedNameSpecifiers) {
@@ -2071,7 +2080,7 @@ TEST_F(FormatTest, FormatObjCMethodExpr) {
verifyFormat(
"void f() {\n"
" if ((self = [super initWithContentRect:contentRect styleMask:styleMask\n"
- " backing:NSBackingStoreBuffered defer:YES]))");
+ " backing:NSBackingStoreBuffered defer:YES]))");
verifyFormat("[foo checkThatBreakingAfterColonWorksOk:\n"
" [bar ifItDoes:reduceOverallLineLengthLikeInThisCase]];");
OpenPOWER on IntegriCloud