[llvm-bugs] [Bug 25971] New: Formatting is not idempotent with 'MaxEmptyLinesToKeep' being 0

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 30 07:16:57 PST 2015


            Bug ID: 25971
           Summary: Formatting is not idempotent with
                    'MaxEmptyLinesToKeep' being 0
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at Alexander.Shukaev.name
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15535
  --> https://llvm.org/bugs/attachment.cgi?id=15535&action=edit
Test C++ code for formatting

1.  $ clang-format -dump-config -style=LLVM | sed
's/\(MaxEmptyLinesToKeep\s*:\s*\).*/\10/g' > .clang-format
2.  $ clang-format test.cpp
3.  $ clang-format test.cpp | clang-format
4.  $ clang-format test.cpp | clang-format | clang-format
5.  $ clang-format test.cpp | clang-format | clang-format | clang-format

Notice how the output of #2 is identical to #4, while #3 is identical to #5,
and the difference between those two variants is the added/removed empty line
before 'private:'.  That is this interleaving pattern of adding/removing this
empty line will repeat infinitely.

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/20151230/297dad49/attachment.html>

More information about the llvm-bugs mailing list