[llvm-bugs] [Bug 47635] New: Add clang-format option to only add a single continuation ident

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 24 06:34:26 PDT 2020


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

            Bug ID: 47635
           Summary: Add clang-format option to only add a single
                    continuation ident
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arichardson.kde at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Currently clang-format will add a new continuationIdent for each nested paren,
but some project styles (e.g. FreeBSD) want a single continuation indent.

Example:
if (sscanf(ln + 16, "%d %d %d %d", &fbbw, &fbbh, &fbbox,
    &fbboy) != 4)
is reformatted to:
if (sscanf(ln + 16, "%d %d %d %d", &fbbw, &fbbh, &fbbox,
        &fbboy) != 4)


Clang-format adds another 4 spaces (continuation ident) for the nested scanf()
call, but the correct style would be to only add a single continuation indent.
See https://reviews.freebsd.org/D26340 for the examples that prompted this bug
report.

I think the existing behaviour makes sense, so fixing this would probably
require
a new format option to only indent once.

-- 
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/20200924/e08bc610/attachment-0001.html>


More information about the llvm-bugs mailing list