diff options
| -rw-r--r-- | clang/lib/Format/Format.cpp | 5 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 12 |
2 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 3496712e3cf..90c3e9e96d5 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -915,10 +915,7 @@ public: } else if (TheLine.Type != LT_Invalid && (WasMoved || FormatPPDirective || touchesLine(TheLine))) { unsigned LevelIndent = getIndent(IndentForLevel, TheLine.Level); - if (FirstTok->WhitespaceRange.isValid() && - // Insert a break even if there is a structural error in case where - // we break apart a line consisting of multiple unwrapped lines. - (FirstTok->NewlinesBefore == 0 || !StructuralError)) { + if (FirstTok->WhitespaceRange.isValid()) { formatFirstToken(*TheLine.First, PreviousLine, TheLine.Level, Indent, TheLine.InPPDirective); } else { diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 6bcf44c4e8d..23a2203b015 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -4373,16 +4373,16 @@ TEST_F(FormatTest, DoesNotTouchUnwrappedLinesWithErrors) { } TEST_F(FormatTest, IncorrectCodeErrorDetection) { - EXPECT_EQ("{\n{}\n", format("{\n{\n}\n")); + EXPECT_EQ("{\n {}\n", format("{\n{\n}\n")); EXPECT_EQ("{\n {}\n", format("{\n {\n}\n")); EXPECT_EQ("{\n {}\n", format("{\n {\n }\n")); - EXPECT_EQ("{\n {}\n }\n}\n", format("{\n {\n }\n }\n}\n")); + EXPECT_EQ("{\n {}\n}\n}\n", format("{\n {\n }\n }\n}\n")); EXPECT_EQ("{\n" - " {\n" - " breakme(\n" - " qwe);\n" - "}\n", + " {\n" + " breakme(\n" + " qwe);\n" + " }\n", format("{\n" " {\n" " breakme(qwe);\n" |

