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