[all-commits] [llvm/llvm-project] e8ea35: [clang-format] [PR44345] Long namespace closing co...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Fri May 15 13:01:33 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e8ea35e63f50486fe497d8565abb8cd5b2820a96
      https://github.com/llvm/llvm-project/commit/e8ea35e63f50486fe497d8565abb8cd5b2820a96
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2020-05-15 (Fri, 15 May 2020)

  Changed paths:
    M clang/lib/Format/NamespaceEndCommentsFixer.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] [PR44345] Long namespace closing comment is duplicated endlessly

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

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79935




More information about the All-commits mailing list