Skip to content

Commit f771d08

Browse files
authored
[clang-format] Fix a bug in ReflowComments: Always (llvm#146202)
Fixes llvm#39150
1 parent d2e8e55 commit f771d08

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

clang/lib/Format/BreakableToken.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ getCommentSplit(StringRef Text, unsigned ContentStartColumn,
158158
return BreakableToken::Split(StringRef::npos, 0);
159159
StringRef BeforeCut = Text.substr(0, SpaceOffset).rtrim(Blanks);
160160
StringRef AfterCut = Text.substr(SpaceOffset);
161-
// Don't trim the leading blanks if it would create a */ after the break.
162-
if (!DecorationEndsWithStar || AfterCut.size() <= 1 || AfterCut[1] != '/')
161+
if (!DecorationEndsWithStar)
163162
AfterCut = AfterCut.ltrim(Blanks);
164163
return BreakableToken::Split(BeforeCut.size(),
165164
AfterCut.begin() - BeforeCut.end());

clang/unittests/Format/FormatTestComments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2486,7 +2486,7 @@ TEST_F(FormatTestComments, BlockComments) {
24862486
EXPECT_EQ("/*\n"
24872487
"**\n"
24882488
"* aaaaaa\n"
2489-
"*aaaaaa\n"
2489+
"* aaaaaa\n"
24902490
"*/",
24912491
format("/*\n"
24922492
"**\n"

0 commit comments

Comments
 (0)