[cfe-commits] r173675 - Improve indentation after breaking at nested name specifiers.
Daniel Jasper
djasper at google.com
Sun Jan 27 23:43:15 PST 2013
Author: djasper
Date: Mon Jan 28 01:43:15 2013
New Revision: 173675
URL: http://llvm.org/viewvc/llvm-project?rev=173675&view=rev
Log:
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);
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=173675&r1=173674&r2=173675&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Mon Jan 28 01:43:15 2013
@@ -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.
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=173675&r1=173674&r2=173675&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Jan 28 01:43:15 2013
@@ -1252,7 +1252,7 @@ TEST_F(FormatTest, WrapsAtNestedNameSpec
// "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(
More information about the cfe-commits
mailing list