[llvm-bugs] [Bug 36611] New: One item per line in array initializer

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 6 01:52:29 PST 2018


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

            Bug ID: 36611
           Summary: One item per line in array initializer
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: martin.thomson at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

clang-format 5 and 6 (haven't tested others) rewrite array initializers with
one item per line when ColumnLimit is 0:

 static const uint8_t ff_dhe_3072_p[] = {
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+    0xFF,
+    0xFF,
+    0xFF,
+    0xFF,
+    0xFF,
+    0xFF,
+    0xFF,
+    0xFF,
 };

The actual example is much larger.

The documentation for ColumnLimit says:

"A column limit of 0 means that there is no column limit. In this case,
clang-format will respect the input’s line breaking decisions within statements
unless they contradict other rules."

That doesn't appear to hold.

The last known version to respect this is 3.9.

-- 
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/20180306/5a813108/attachment.html>


More information about the llvm-bugs mailing list