From f9a5e4043cd9d04cdc45e89bfe73c4e361c5383d Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Tue, 8 Oct 2013 16:24:07 +0000 Subject: clang-format: Improve indentation when deriving from templated classes. Before: struct aaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa< // aaaaaaaaaaaaaaaa> {}; struct aaaaaaaaaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa< aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa> {}; After: struct aaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa< // aaaaaaaaaaaaaaaa> {}; struct aaaaaaaaaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa {}; llvm-svn: 192187 --- clang/lib/Format/ContinuationIndenter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang/lib/Format/ContinuationIndenter.cpp') diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index ff1f1aa8534..3714088306c 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -278,9 +278,10 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, // simple assignment without binary expression on the RHS. Also indent // relative to unary operators and the colons of constructor initializers. State.Stack.back().LastSpace = State.Column; - else if (Previous.Type == TT_InheritanceColon) + else if (Previous.Type == TT_InheritanceColon) { State.Stack.back().Indent = State.Column; - else if (Previous.opensScope()) { + State.Stack.back().LastSpace = State.Column; + } else if (Previous.opensScope()) { // If a function has a trailing call, indent all parameters from the // opening parenthesis. This avoids confusing indents like: // OuterFunction(InnerFunctionCall( // break -- cgit v1.2.3