[PATCH] D79935: [clang-format] [PR44345] Long namespace closing comment is duplicated endlessly

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 14 04:15:33 PDT 2020


MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: krasimir, JakeMerdichAMD, mitchell-stellar, sammccall, curdeius.
MyDeveloperDay added projects: clang, clang-format.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79935

Files:
  clang/lib/Format/NamespaceEndCommentsFixer.cpp
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79935.263965.patch
Type: text/x-patch
Size: 3823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200514/74829880/attachment.bin>


More information about the cfe-commits mailing list