aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2012-12-17 11:29:41 +0000
committerDaniel Jasper <djasper@google.com>2012-12-17 11:29:41 +0000
commit05b1ac8791ee89fdf0b275631ab8118febc7c33d (patch)
tree0932ed10ab7b43606b21e78a7ee848fb9b5d8c98 /lib/Format/Format.cpp
parent728e2127e858611750d560ee7692c322a8570faa (diff)
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
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index e8faa12a26..eb077d39e5 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -734,15 +734,16 @@ private:
}
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));
}