diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Format/Format.cpp | 15 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 4 |
2 files changed, 5 insertions, 14 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 4c7c405e81e..814017a5127 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -338,10 +338,6 @@ private: return ColonPos < Other.ColonPos; if (StartOfFunctionCall != Other.StartOfFunctionCall) return StartOfFunctionCall < Other.StartOfFunctionCall; - if (NestedNameSpecifierContinuation != - Other.NestedNameSpecifierContinuation) - return NestedNameSpecifierContinuation < - Other.NestedNameSpecifierContinuation; if (CallContinuation != Other.CallContinuation) return CallContinuation < Other.CallContinuation; if (VariablePos != Other.VariablePos) @@ -432,13 +428,6 @@ private: } else if (Current.is(tok::lessless) && State.Stack.back().FirstLessLess != 0) { State.Column = State.Stack.back().FirstLessLess; - } else if (Previous.is(tok::coloncolon)) { - if (State.Stack.back().NestedNameSpecifierContinuation == 0) { - State.Column = ContinuationIndent; - State.Stack.back().NestedNameSpecifierContinuation = State.Column; - } else { - State.Column = State.Stack.back().NestedNameSpecifierContinuation; - } } else if (Current.isOneOf(tok::period, tok::arrow)) { if (State.Stack.back().CallContinuation == 0) { State.Column = ContinuationIndent; @@ -464,7 +453,8 @@ private: State.Stack.back().ColonPos = State.Column + Current.FormatTok.TokenLength; } - } else if (Current.Type == TT_StartOfName || Previous.is(tok::equal) || + } else if (Current.Type == TT_StartOfName || + Previous.isOneOf(tok::coloncolon, tok::equal) || Previous.Type == TT_ObjCMethodExpr) { State.Column = ContinuationIndent; } else { @@ -854,6 +844,7 @@ private: // Reconstruct the solution. reconstructPath(InitialState, Queue.top().second); + DEBUG(llvm::errs() << "Total number of analyzed states: " << Count << "\n"); DEBUG(llvm::errs() << "---\n"); // Return the column after the last token of the solution. diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 92435fe0fe4..2a11f80eaa5 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -2338,11 +2338,11 @@ TEST_F(FormatTest, WrapsAtNestedNameSpecifiers) { " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa());"); - // FIXME: Should we have an extra indent after the second break? + // FIXME: Should we have the extra indent after the second break? verifyFormat( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa::\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa::\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();"); + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();"); // FIXME: Look into whether we should indent 4 from the start or 4 from // "bbbbb..." here instead of what we are doing now. |