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

            Bug ID: 37875
           Summary: clang-format repeatedly adds new comment line
           Product: clang
           Version: 6.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: dr.kh...@gmail.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Created attachment 20446
  --> https://bugs.llvm.org/attachment.cgi?id=20446&action=edit
format file to reproduce the issue

When instructing clang-format to comment the closing bracket of a namespace
with the namespace name, in some situations with very long namespace names,
that comment is added repeatedly when re-formatting code.


Example:
*******

namespace protobuf_tensorflow_2fcore_2fframework_2fresource_5fhandle_2eproto
{
struct StaticDescriptorInitializer {
}
}

After formatting 5 times:
************************
namespace protobuf_tensorflow_2fcore_2fframework_2fresource_5fhandle_2eproto
{
struct StaticDescriptorInitializer {
}
} // namespace
  // protobuf_tensorflow_2fcore_2fframework_2fresource_5fhandle_2eproto
  // protobuf_tensorflow_2fcore_2fframework_2fresource_5fhandle_2eproto
  // protobuf_tensorflow_2fcore_2fframework_2fresource_5fhandle_2eproto
  // protobuf_tensorflow_2fcore_2fframework_2fresource_5fhandle_2eproto
  // protobuf_tensorflow_2fcore_2fframework_2fresource_5fhandle_2eproto


.clang-format is attached.

Setting FixNamespaceComments: false fixes the issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to