This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] [PR44345] Long namespace closing comment is duplicated endlessly
ClosedPublic

Authored by MyDeveloperDay on May 14 2020, 3:45 AM.

Details

Summary

https://bugs.llvm.org/show_bug.cgi?id=44345

When namespaces get long the namespace end comment wraps onto the next line

namespace would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::
    went::mad::now {
void foo();
void bar();
} // namespace
  // would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now

If clang-format it applied successively it will duplicate the end comment

namespace would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::
    went::mad::now {
void foo();
void bar();
} // namespace
  // would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now
  // would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now

This revision checks to ensure the end comment is not on the next line before adding yet another comment

Diff Detail

Event Timeline

MyDeveloperDay created this revision.May 14 2020, 3:45 AM
krasimir accepted this revision.May 14 2020, 1:20 PM

Awesome! Thank you!

This revision is now accepted and ready to land.May 14 2020, 1:20 PM
curdeius added inline comments.May 15 2020, 5:39 AM
clang/lib/Format/NamespaceEndCommentsFixer.cpp
129

Nit: typo commenline -> commentline.

MyDeveloperDay marked an inline comment as done.May 15 2020, 12:54 PM
This revision was automatically updated to reflect the committed changes.