Skip to content

Commit d74a8b2

Browse files
committed
Address more review comments
1 parent 0d5e911 commit d74a8b2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clang/lib/Format/UnwrappedLineFormatter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,13 +637,13 @@ class LineJoiner {
637637
const auto BraceOpenLine = I + OpenBraceWrapped;
638638

639639
assert(*BraceOpenLine);
640-
if ((*BraceOpenLine)->Last->isNot(tok::l_brace))
640+
if (BraceOpenLine[0]->Last->isNot(TT_NamespaceLBrace))
641641
return 0;
642642

643643
if (std::distance(BraceOpenLine, E) <= 2)
644644
return 0;
645645

646-
if (BraceOpenLine[0]->Last->is(TT_LineComment))
646+
if (BraceOpenLine[0]->Last->is(tok::comment))
647647
return 0;
648648

649649
assert(BraceOpenLine[1]);
@@ -682,7 +682,8 @@ class LineJoiner {
682682
return 0;
683683
// Check that the line after the inner result starts with a closing brace
684684
// which we are permitted to merge into one line.
685-
if (I[N]->First->is(tok::r_brace) && !I[N]->First->MustBreakBefore &&
685+
if (I[N]->First->is(TT_NamespaceRBrace) &&
686+
!I[N]->First->MustBreakBefore &&
686687
BraceOpenLine[MergedLines + 1]->Last->isNot(tok::comment) &&
687688
nextNLinesFitInto(I, I + N + 1, Limit)) {
688689
return N;
@@ -698,7 +699,7 @@ class LineJoiner {
698699
return 0;
699700

700701
// Last, check that the third line starts with a closing brace.
701-
if (L2.First->isNot(tok::r_brace) || L2.First->MustBreakBefore)
702+
if (L2.First->isNot(TT_NamespaceRBrace) || L2.First->MustBreakBefore)
702703
return 0;
703704

704705
// If so, merge all lines.

clang/unittests/Format/FormatTest.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28446,7 +28446,6 @@ TEST_F(FormatTest, ShortNamespacesOption) {
2844628446
"class bar;\n"
2844728447
"}",
2844828448
Style);
28449-
2845028449
verifyFormat("namespace foo\n"
2845128450
"{\n"
2845228451
"namespace bar\n"

0 commit comments

Comments
 (0)