diff options
| author | Daniel Jasper <djasper@google.com> | 2014-07-28 14:08:09 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-07-28 14:08:09 +0000 |
| commit | a382cbe4eb53d5cd0626e68e0cc60cc9172e9988 (patch) | |
| tree | 40e5fdbd9dcdc145502ae6a87d7b73946c3c92a7 /clang/lib/Format/TokenAnnotator.cpp | |
| parent | 3baf5b390d5027f8cd652946df0e8cb67b1c794d (diff) | |
| download | bcm5719-llvm-a382cbe4eb53d5cd0626e68e0cc60cc9172e9988.tar.gz bcm5719-llvm-a382cbe4eb53d5cd0626e68e0cc60cc9172e9988.zip | |
clang-format: [proto] Improve formatting of text-proto options.
Initial patch and tests by Kaushik Sridharan, thank you!
llvm-svn: 214084
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 885d147b9b6..269e2fc28aa 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -311,8 +311,7 @@ private: if (CurrentToken->isOneOf(tok::r_paren, tok::r_square)) return false; updateParameterCount(Left, CurrentToken); - if (CurrentToken->is(tok::colon) && - Style.Language != FormatStyle::LK_Proto) { + if (CurrentToken->is(tok::colon)) { if (CurrentToken->getPreviousNonComment()->is(tok::identifier)) CurrentToken->getPreviousNonComment()->Type = TT_SelectorName; Left->Type = TT_DictLiteral; @@ -1683,6 +1682,9 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, } else if (isAllmanBrace(Left) || isAllmanBrace(Right)) { return Style.BreakBeforeBraces == FormatStyle::BS_Allman || Style.BreakBeforeBraces == FormatStyle::BS_GNU; + } else if (Style.Language == FormatStyle::LK_Proto && + Left.isNot(tok::l_brace) && Right.Type == TT_SelectorName) { + return true; } // If the last token before a '}' is a comma or a comment, the intention is to |

