diff options
| -rw-r--r-- | clang/lib/Format/Format.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index b2bf3fea98d..02cbc316c17 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -936,7 +936,7 @@ private: State.NextToken = State.NextToken->Next; if (!Newline && Style.AlwaysBreakBeforeMultilineStrings && - Current.is(tok::string_literal)) + Current.is(tok::string_literal) && Current.CanBreakBefore) return 0; return breakProtrudingToken(Current, State, DryRun); diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 3a3164c0f48..ba78995eb51 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5167,6 +5167,11 @@ TEST_F(FormatTest, BreakStringLiterals) { "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaaaaaaaa\");", getGoogleStyle())); + EXPECT_EQ("llvm::outs() << \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \"\n" + " \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\";", + format("llvm::outs() << " + "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaa\";")); FormatStyle AlignLeft = getLLVMStyleWithColumns(12); AlignLeft.AlignEscapedNewlinesLeft = true; |

