diff options
author | Daniel Jasper <djasper@google.com> | 2013-04-05 17:22:09 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-04-05 17:22:09 +0000 |
commit | 6b119d63f5036344acd4e00a6ff2b3c72f26966f (patch) | |
tree | 8b598309a67d06ab6cf016966d7fcce1c60967f3 /lib/Format | |
parent | 27b91cc046f580fbe825f15b3e27f1b6407ee3e3 (diff) |
Allow breaking after 'class' for classes with looong names.
(Don't ask, this was a user request).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178888 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format')
-rw-r--r-- | lib/Format/TokenAnnotator.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 24e2b1f87e..44421c4bbe 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -939,6 +939,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, return 150; if (Left.is(tok::coloncolon)) return 500; + if (Left.isOneOf(tok::kw_class, tok::kw_struct)) + return 5000; if (Left.Type == TT_RangeBasedForLoopColon || Left.Type == TT_InheritanceColon) @@ -1176,7 +1178,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, if (Left.is(tok::identifier) && Right.is(tok::string_literal)) return true; return (isBinaryOperator(Left) && Left.isNot(tok::lessless)) || - Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace) || + Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, + tok::kw_class, tok::kw_struct) || Right.isOneOf(tok::lessless, tok::arrow, tok::period, tok::colon) || (Left.is(tok::r_paren) && Left.Type != TT_CastRParen && Right.isOneOf(tok::identifier, tok::kw___attribute)) || |