Fix several formatting problems.
More specifically:
- Improve formatting of static initializers.
- Fix formatting of lines comments in enums.
- Fix formmating of trailing line comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170316 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index e8faa12..eb077d3 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -734,15 +734,16 @@
}
bool canBreakBetween(const FormatToken &Left, const FormatToken &Right) {
- if (Right.Tok.is(tok::r_paren))
+ if (Right.Tok.is(tok::r_paren) || Right.Tok.is(tok::l_brace) ||
+ Right.Tok.is(tok::comment) || Right.Tok.is(tok::greater))
return false;
if (isBinaryOperator(Left))
return true;
if (Right.Tok.is(tok::lessless))
return true;
- return Right.Tok.is(tok::colon) || Left.Tok.is(tok::comma) ||
- Left.Tok.is(tok::semi) || Left.Tok.is(tok::equal) ||
- Left.Tok.is(tok::ampamp) || Left.Tok.is(tok::pipepipe) ||
+ return Right.Tok.is(tok::colon) || Left.Tok.is(tok::comma) || Left.Tok.is(
+ tok::semi) || Left.Tok.is(tok::equal) || Left.Tok.is(tok::ampamp) ||
+ Left.Tok.is(tok::pipepipe) || Left.Tok.is(tok::l_brace) ||
(Left.Tok.is(tok::l_paren) && !Right.Tok.is(tok::r_paren));
}