[llvm-bugs] [Bug 33915] New: clang-format AlignOperands insufficient to describe all on one line or one line per

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 24 13:33:33 PDT 2017


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

            Bug ID: 33915
           Summary: clang-format AlignOperands insufficient to describe
                    all on one line or one line per
           Product: new-bugs
           Version: 4.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: azy.development at gmail.com
                CC: llvm-bugs at lists.llvm.org

AlignOperands enables alignment when items exceed the line character limit
however it doesn't sufficiently describe (and probably shouldn't conflate) the
one line for all or one line per item capability.

Example:

Unformatted (all on one line):

uint64_t foo = 1231123413 | 1231234123412341234123413241234123413 |
12312312312341234123413;


Formatted with ‘AlignOperands:   true’ (when exceeding line limit):

uint64_t foo = 1231123413 | 1231234123412341234123413241234123413
               | 12312312312341234123413;


Desired formatting (one line per only if exceeding line limit):

uint64_t foo = 1231123413
               | 1231234123412341234123413241234123413
               | 12312312312341234123413;

This should probably be a new config bool.

This is good for when working with binary ORs/ANDs/etc in embedded programming
where each line represents a specific bit that’s being set. This is all but
impossible to read without this feature especially when the bits being set are
computed at runtime with function calls and whatnot needed per bit.

PS. There is an additional config bit possible which forces all situations to
put everything on one line each but that's probably not that useful; unlikely
that folks would want every addition to be on 2 lines for example.

-- 
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/20170724/63ac6378/attachment.html>


More information about the llvm-bugs mailing list