diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 680bb1301317..a98d565caa4a 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -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; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index ae4d9f5c0d9b..6e53f92e5a84 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -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) {