aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-02-04 07:30:30 +0000
committerDaniel Jasper <djasper@google.com>2013-02-04 07:30:30 +0000
commit8159d2f271c9142b46a672ac2c45821911171a7d (patch)
tree2898260479664ea4c08e4e1a1d0918a701dfef7f /lib/Format/TokenAnnotator.cpp
parent0178673f541685cf5067814dfeee2644078e39a9 (diff)
Fix an error in formatting of for-loops.
Two minor changes: * Slight penalty for breaking at "," as opposed to ";". * Don't apply bin-packing rules to for-loops. Before: for (int aaaaaa = aaaaaaaaaa; aaaaaa < bbbbbbbb; ++aaaaaa, ++ccccccccccccccc) {} After: for (int aaaaaa = aaaaaaaaaa; aaaaaa < bbbbbbbb; ++aaaaaa, ++ccccccccccccccc) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174308 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/TokenAnnotator.cpp')
-rw-r--r--lib/Format/TokenAnnotator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 1eb7021ac6..0676df6c0e 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -714,8 +714,10 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedToken &Tok) {
(Left.isNot(tok::comma) && Left.isNot(tok::semi)))
return 20;
- if (Left.is(tok::semi) || Left.is(tok::comma))
+ if (Left.is(tok::semi))
return 0;
+ if (Left.is(tok::comma))
+ return 1;
// In Objective-C method expressions, prefer breaking before "param:" over
// breaking after it.