clang-format: Fix bug concerning the alignment of "}".

Before:
    int i;  // indented 2 space more than clang-format would use.
    SomeReturnType  // clang-format invoked on this line.
    SomeFunctionMakingLBraceEndInColumn80() {
  }  // This is the indent clang-format would prefer.

After:
    int i;  // indented 2 space more than clang-format would use.
    SomeReturnType  // clang-format invoked on this line.
    SomeFunctionMakingLBraceEndInColumn80() {
    }

llvm-svn: 186120
This commit is contained in:
Daniel Jasper 2013-07-11 21:27:40 +00:00
parent 29b3fdc8c2
commit 51efbad732
2 changed files with 8 additions and 1 deletions

View File

@ -536,7 +536,7 @@ private:
if (Current.BlockKind == BK_BracedInit)
State.Column = State.Stack[State.Stack.size() - 2].LastSpace;
else
State.Column = Line.Level * Style.IndentWidth;
State.Column = FirstIndent;
} else if (Current.is(tok::string_literal) &&
State.StartOfStringLiteral != 0) {
State.Column = State.StartOfStringLiteral;

View File

@ -4810,6 +4810,13 @@ TEST_F(FormatTest, ReformatRegionAdjustsIndent) {
" // line 2\n"
" int b;",
35, 0, getLLVMStyle()));
EXPECT_EQ(" int a;\n"
" void\n"
" ffffff() {\n"
" }",
format(" int a;\n"
"void ffffff() {}",
11, 0, getLLVMStyleWithColumns(11)));
}
TEST_F(FormatTest, BreakStringLiterals) {