summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-05-06 06:45:09 +0000
committerDaniel Jasper <djasper@google.com>2013-05-06 06:45:09 +0000
commitc194c95036b7bf1281a6f2ed683f7c85ee5d2c20 (patch)
tree62afb62e0e21f88c1d45ed6f6622885207ad0bfc
parentf022018698ced7e538b338d4f7befef9f81051ea (diff)
Break the class-inheritance ":" to the new line.
This seems to be more common in LLVM, Google and Chromium. Before: class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB, public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC { }; After: class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB, public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC { }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181183 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Format/TokenAnnotator.cpp4
-rw-r--r--unittests/Format/FormatTest.cpp6
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 10ced9a7ee..fa7ef78451 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -1137,11 +1137,9 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
if (Right.Type == TT_ConditionalExpr || Right.is(tok::question))
return true;
if (Right.Type == TT_RangeBasedForLoopColon ||
- Right.Type == TT_InheritanceColon ||
Right.Type == TT_OverloadedOperatorLParen)
return false;
- if (Left.Type == TT_RangeBasedForLoopColon ||
- Left.Type == TT_InheritanceColon)
+ if (Left.Type == TT_RangeBasedForLoopColon)
return true;
if (Right.Type == TT_RangeBasedForLoopColon)
return false;
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index ed1e6ed623..2b74506fc0 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1019,9 +1019,9 @@ TEST_F(FormatTest, FormatsClasses) {
"class AAAAAAAAAAAAAAAAAAAA : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,\n"
" public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC {\n"
"};\n");
- verifyFormat("class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA :\n"
- " public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,\n"
- " public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC {\n"
+ verifyFormat("class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+ " : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,\n"
+ " public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC {\n"
"};\n");
verifyFormat(
"class A : public B, public C, public D, public E, public F, public G {\n"