Skip to content

Commit 492382e

Browse files
committed
NFC
1 parent 3efb5ca commit 492382e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

clang/lib/Format/FormatTokenLexer.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,17 +1336,16 @@ FormatToken *FormatTokenLexer::getNextToken() {
13361336
// finds comments that contain a backslash followed by a line break, truncates
13371337
// the comment token at the backslash, and resets the lexer to restart behind
13381338
// the backslash.
1339-
if ((Style.isCpp() || Style.isJavaScript() || Style.isJava()) &&
1340-
FormatTok->is(tok::comment)) {
1341-
if (const auto Text = FormatTok->TokenText; Text.starts_with("//")) {
1342-
for (auto Pos = Text.find('\\'); Pos++ != StringRef::npos;
1343-
Pos = Text.find('\\', Pos)) {
1344-
if (Pos < Text.size() && Text[Pos] == '\n' &&
1345-
(!Style.isCpp() ||
1346-
Text.substr(Pos + 1).ltrim().starts_with("//"))) {
1347-
truncateToken(Pos);
1348-
break;
1349-
}
1339+
if (const auto Text = FormatTok->TokenText;
1340+
Text.starts_with("//") &&
1341+
(Style.isCpp() || Style.isJavaScript() || Style.isJava())) {
1342+
assert(FormatTok->is(tok::comment));
1343+
for (auto Pos = Text.find('\\'); Pos++ != StringRef::npos;
1344+
Pos = Text.find('\\', Pos)) {
1345+
if (Pos < Text.size() && Text[Pos] == '\n' &&
1346+
(!Style.isCpp() || Text.substr(Pos + 1).ltrim().starts_with("//"))) {
1347+
truncateToken(Pos);
1348+
break;
13501349
}
13511350
}
13521351
}

0 commit comments

Comments
 (0)