forked from OSchip/llvm-project
parent
14e58e5290
commit
28df0a356e
|
@ -1122,7 +1122,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) {
|
|||
// SomeFunction(a,
|
||||
// b, // comment
|
||||
// c);
|
||||
if (Current->isTrailingComment()) {
|
||||
if (!Current->HasUnescapedNewline) {
|
||||
for (FormatToken *Parameter = Current->Previous; Parameter;
|
||||
Parameter = Parameter->Previous) {
|
||||
if (Parameter->isOneOf(tok::comment, tok::r_brace))
|
||||
|
|
|
@ -784,6 +784,13 @@ TEST_F(FormatTest, KeepsParameterWithTrailingCommentsOnTheirOwnLine) {
|
|||
format("SomeFunction(a,\n"
|
||||
" b, // comment\n"
|
||||
" c);"));
|
||||
EXPECT_EQ("SomeFunction(a, b,\n"
|
||||
" // comment\n"
|
||||
" c);",
|
||||
format("SomeFunction(a,\n"
|
||||
" b,\n"
|
||||
" // comment\n"
|
||||
" c);"));
|
||||
EXPECT_EQ("SomeFunction(a, b, // comment (unclear relation)\n"
|
||||
" c);",
|
||||
format("SomeFunction(a, b, // comment (unclear relation)\n"
|
||||
|
|
Loading…
Reference in New Issue