[llvm-bugs] [Bug 28762] New: clang-format: add a style option for disabling all function arguments on one line

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 28 16:54:49 PDT 2016


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

            Bug ID: 28762
           Summary: clang-format: add a style option for disabling all
                    function arguments on one line
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jacobsa at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The style option `AllowAllParametersOfDeclarationOnNextLine` allows me to
prevent clang-format from pulling all parameters in a function declaration onto
a single line when I have intentionally put them on separate lines. This is
great.

But there doesn't appear to be a corresponding option for function calls.
`clang-format` is happy to pull function arguments onto a single line, even
when I've intentionally put them on separate lines and disabled bin packing.

Small example that reproduces this:

    % cat .clang-format 
    ColumnLimit: 80
    BinPackArguments: false
    BinPackParameters: false
    AllowAllParametersOfDeclarationOnNextLine: false
    AlignAfterOpenBracket: AlwaysBreak


    % cat foo.cc
    extern int arg_0, arg_1, arg_2;

    void
DoSomethingWithThreeIntsThatRequiresAVeryLongFunctionNameSeriouslyLong(
        int a,
        int b,
        int c);

    void foo() {
      // I'm intentionally putting these one per line; I want them to align.
      DoSomethingWithThreeIntsThatRequiresAVeryLongFunctionNameSeriouslyLong(
          arg_0,
          arg_1,
          arg_2);
    }


    % clang-format -style=file foo.cc
    extern int arg_0, arg_1, arg_2;

    void
DoSomethingWithThreeIntsThatRequiresAVeryLongFunctionNameSeriouslyLong(
        int a,
        int b,
        int c);

    void foo() {
      // I'm intentionally putting these one per line; I want them to align.
      DoSomethingWithThreeIntsThatRequiresAVeryLongFunctionNameSeriouslyLong(
          arg_0, arg_1, arg_2);
    }

-- 
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/20160728/c0b6520c/attachment.html>


More information about the llvm-bugs mailing list