diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-25 15:43:32 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-25 15:43:32 +0000 |
commit | 7a31af140b3a7beada378700a4795e38dd886188 (patch) | |
tree | 9e7561664b4abde25650f83b10d53b5b1fcf2fca /clang/lib/Format | |
parent | 0e5becb8302ec6838eb8d31ab3b74f226ce54133 (diff) | |
download | bcm5719-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/lib/Format')
-rw-r--r-- | clang/lib/Format/Format.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 1cac334125b..ed7f35486c6 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -609,7 +609,7 @@ private: // Treat the condition inside an if as if it was a second function // parameter, i.e. let nested calls have an indent of 4. State.Stack.back().LastSpace = State.Column + 1; // 1 is length of "(". - else if (Spaces > 0 && ParenLevel != 0) + else if (Previous.is(tok::comma) && ParenLevel != 0) // Top-level spaces are exempt as that mostly leads to better results. State.Stack.back().LastSpace = State.Column; } @@ -706,7 +706,7 @@ private: if (Right.is(tok::colon) && Right.Type == TT_ObjCMethodExpr) return 20; - if (Left.is(tok::l_paren)) + if (Left.is(tok::l_paren) || Left.Type == TT_TemplateOpener) return 20; if (Left.is(tok::question) || Left.Type == TT_ConditionalExpr) |