aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-28 07:43:15 +0000
committerDaniel Jasper <djasper@google.com>2013-01-28 07:43:15 +0000
commit5f2173ee723fd17b758f2a35a5bb39ca74eca523 (patch)
tree6696429054970e1479b1f25dade8555e3eb4e078
parent986e17ff3bd3df2762f88569cab3fdfbabc08bb1 (diff)
Improve indentation after breaking at nested name specifiers.
These always represent a continuation and we should increase the ident. Before: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa:: aaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173675 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Format/Format.cpp7
-rw-r--r--unittests/Format/FormatTest.cpp2
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index bae1bbb86d..99b2d545c2 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -550,9 +550,10 @@ private:
State.Stack[ParenLevel].FirstLessLess != 0) {
State.Column = State.Stack[ParenLevel].FirstLessLess;
} else if (ParenLevel != 0 &&
- (Previous.is(tok::equal) || Current.is(tok::arrow) ||
- Current.is(tok::period) || Previous.is(tok::question) ||
- Previous.Type == TT_ConditionalExpr)) {
+ (Previous.is(tok::equal) || Previous.is(tok::coloncolon) ||
+ Previous.is(tok::question) ||
+ Previous.Type == TT_ConditionalExpr ||
+ Current.is(tok::period) || Current.is(tok::arrow))) {
// Indent and extra 4 spaces after if we know the current expression is
// continued. Don't do that on the top level, as we already indent 4
// there.
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index d877dc29e5..e47c7a5196 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1252,7 +1252,7 @@ TEST_F(FormatTest, WrapsAtNestedNameSpecifiers) {
// "bbbbb..." here instead of what we are doing now.
verifyFormat(
"aaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb::\n"
- " cccccccccccccccccccccccccccccccccccccccccccccccccc());");
+ " cccccccccccccccccccccccccccccccccccccccccccccc());");
// Breaking at nested name specifiers is generally not desirable.
verifyFormat(