[llvm-bugs] [Bug 44195] New: clang-format incorrectly detects function arguments as function parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 1 06:15:02 PST 2019


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

            Bug ID: 44195
           Summary: clang-format incorrectly detects function arguments as
                    function parameters
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pablomg+llvm at eskapa.be
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

While trying to reproduce bug 35968, I noticed this incorrect behaviour:
$ cat test.cpp
testXUnreportedInfo(
    0xaaaaaaaaaaaaaaaaa, 0xbbbbbbbbbbbbbbbbbbbbbb, 0xcccccccccccccccccccc);

ret = testXUnreportedInfo(
    "aaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbb", "cccccccccccccccccccc");

int testXUnreportedInfo(
    int aaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbbbbbbbbbbb, int
cccccccccccccccccccc){}
$ ./clang-format test.cpp -style="{AllowAllArgumentsOnNextLine: false,
AllowAllParametersOfDeclarationOnNextLine: false, BinPackArguments: true,
BinPackParameters: false}"
testXUnreportedInfo(0xaaaaaaaaaaaaaaaaa,
                    0xbbbbbbbbbbbbbbbbbbbbbb,
                    0xcccccccccccccccccccc);

ret = testXUnreportedInfo("aaaaaaaaaaaaaaaaa",
                          "bbbbbbbbbbbbbbbbbbbbbb",
                          "cccccccccccccccccccc");

int testXUnreportedInfo(int aaaaaaaaaaaaaaaaa,
                        int bbbbbbbbbbbbbbbbbbbbbb,
                        int cccccccccccccccccccc) {}
$ clang-format test.cpp -style="{AllowAllArgumentsOnNextLine: false,
AllowAllParametersOfDeclarationOnNextLine: false, BinPackArguments: false,
BinPackParameters: true}"
testXUnreportedInfo(0xaaaaaaaaaaaaaaaaa, 0xbbbbbbbbbbbbbbbbbbbbbb,
                    0xcccccccccccccccccccc);

ret = testXUnreportedInfo("aaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbb",
                          "cccccccccccccccccccc");

int testXUnreportedInfo(int aaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbbbbbbbbbbb,
                        int cccccccccccccccccccc) {}

Both function calls react like a function declaration.

Expected result:
$ ./clang-format test.cpp -style="{AllowAllArgumentsOnNextLine: false,
AllowAllParametersOfDeclarationOnNextLine: false, BinPackArguments: true,
BinPackParameters: false}"
testXUnreportedInfo(0xaaaaaaaaaaaaaaaaa, 0xbbbbbbbbbbbbbbbbbbbbbb,
                    0xcccccccccccccccccccc);

ret = testXUnreportedInfo("aaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbb",
                          "cccccccccccccccccccc");

int testXUnreportedInfo(int aaaaaaaaaaaaaaaaa,
                        int bbbbbbbbbbbbbbbbbbbbbb,
                        int cccccccccccccccccccc) {}
$ clang-format test.cpp -style="{AllowAllArgumentsOnNextLine: false,
AllowAllParametersOfDeclarationOnNextLine: false, BinPackArguments: false,
BinPackParameters: true}"
testXUnreportedInfo(0xaaaaaaaaaaaaaaaaa,
                    0xbbbbbbbbbbbbbbbbbbbbbb,
                    0xcccccccccccccccccccc);

ret = testXUnreportedInfo("aaaaaaaaaaaaaaaaa",
                          "bbbbbbbbbbbbbbbbbbbbbb",
                          "cccccccccccccccccccc");

int testXUnreportedInfo(int aaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbbbbbbbbbbb,
                        int cccccccccccccccccccc) {}

-- 
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/20191201/351a0dda/attachment.html>


More information about the llvm-bugs mailing list