forked from OSchip/llvm-project
Fix another clang-format crasher related to multi-line comments.
This fixes: /* * * something long going over the column limit. */ llvm-svn: 182932
This commit is contained in:
parent
29d9318c0c
commit
58dd2f0652
|
@ -241,6 +241,9 @@ BreakableBlockComment::BreakableBlockComment(const FormatStyle &Style,
|
||||||
Lines[i] = Lines[i].substr(Offset);
|
Lines[i] = Lines[i].substr(Offset);
|
||||||
LeadingWhitespace[i] += Offset;
|
LeadingWhitespace[i] += Offset;
|
||||||
}
|
}
|
||||||
|
// Exclude empty lines from the calculation of the left-most column.
|
||||||
|
if (Lines[i].empty())
|
||||||
|
continue;
|
||||||
IndentAtLineBreak = std::min<int>(IndentAtLineBreak, StartOfLineColumn[i]);
|
IndentAtLineBreak = std::min<int>(IndentAtLineBreak, StartOfLineColumn[i]);
|
||||||
}
|
}
|
||||||
DEBUG({
|
DEBUG({
|
||||||
|
|
|
@ -3641,6 +3641,17 @@ TEST_F(FormatTest, BlockComments) {
|
||||||
"/* */someCall(parameter);",
|
"/* */someCall(parameter);",
|
||||||
getLLVMStyleWithColumns(15)));
|
getLLVMStyleWithColumns(15)));
|
||||||
EXPECT_EQ("/*\n**\n*/", format("/*\n**\n*/"));
|
EXPECT_EQ("/*\n**\n*/", format("/*\n**\n*/"));
|
||||||
|
// FIXME: Consider whether empty lines can dictated the left-most column.
|
||||||
|
EXPECT_EQ("/*\n"
|
||||||
|
"*\n"
|
||||||
|
" * aaaaaa\n"
|
||||||
|
" * aaaaaa\n"
|
||||||
|
"*/",
|
||||||
|
format("/*\n"
|
||||||
|
"*\n"
|
||||||
|
" * aaaaaa aaaaaa\n"
|
||||||
|
"*/",
|
||||||
|
getLLVMStyleWithColumns(10)));
|
||||||
|
|
||||||
FormatStyle NoBinPacking = getLLVMStyle();
|
FormatStyle NoBinPacking = getLLVMStyle();
|
||||||
NoBinPacking.BinPackParameters = false;
|
NoBinPacking.BinPackParameters = false;
|
||||||
|
|
Loading…
Reference in New Issue