[llvm-bugs] [Bug 37875] New: clang-format repeatedly adds new comment line

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 20 02:13:31 PDT 2018


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: unassignedclangbugs at nondot.org
          Reporter: dr.khong at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180620/5721dd4f/attachment.html>


More information about the llvm-bugs mailing list