forked from OSchip/llvm-project
clang-format: Fix AlwaysBreakBeforeMultilineStrings with ColumnLimit=0
Before: const char *x = "hello llvm"; After: const char *x = "hello llvm"; This fixes llvm.org/PR22245. Patch by Bill Meltsner, thank you! llvm-svn: 226564
This commit is contained in:
parent
fbeb7e65d9
commit
6fd5d646cc
|
@ -1081,8 +1081,9 @@ bool ContinuationIndenter::nextIsMultilineString(const LineState &State) {
|
|||
if (Current.getNextNonComment() &&
|
||||
Current.getNextNonComment()->isStringLiteral())
|
||||
return true; // Implicit concatenation.
|
||||
if (State.Column + Current.ColumnWidth + Current.UnbreakableTailLength >
|
||||
Style.ColumnLimit)
|
||||
if (Style.ColumnLimit != 0 &&
|
||||
State.Column + Current.ColumnWidth + Current.UnbreakableTailLength >
|
||||
Style.ColumnLimit)
|
||||
return true; // String will be split.
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4611,6 +4611,9 @@ TEST_F(FormatTest, AlwaysBreakBeforeMultilineStrings) {
|
|||
format("NSString *const kString = @\"aaaa\"\n"
|
||||
"\"bbbb\";",
|
||||
Break));
|
||||
|
||||
Break.ColumnLimit = 0;
|
||||
verifyFormat("const char *hello = \"hello llvm\";", Break);
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, AlignsPipes) {
|
||||
|
|
Loading…
Reference in New Issue