[llvm-bugs] [Bug 52476] New: AfterControlStatement MultiLine sometimes doesn't work

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 11 06:37:26 PST 2021


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

            Bug ID: 52476
           Summary: AfterControlStatement MultiLine sometimes doesn't work
           Product: clang
           Version: 13.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: realnc at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

With this clang-format file:

---
Language: Cpp
Standard: Latest
BasedOnStyle: WebKit
BraceWrapping:
  AfterControlStatement: MultiLine
ColumnLimit: 100
...

The following code:

void foo()
{
    if (vmType == VM_GGT_TADS2 or vmType == VM_GGT_TADS3 or
file_is_savestate(finfo.absoluteFilePath())) {
        bar();
    }
}

is formatted incorrectly:

void foo()
{
    if (vmType == VM_GGT_TADS2 || vmType == VM_GGT_TADS3
        || file_is_savestate(finfo.absoluteFilePath())) {
        bar();
    }
}

What it should be is:

void foo()
{
    if (vmType == VM_GGT_TADS2 || vmType == VM_GGT_TADS3
        || file_is_savestate(finfo.absoluteFilePath()))
    {
        bar();
    }
}

This isn't the case with all code. It mostly works, but with some code
constructs (like the above example) it doesn't.

-- 
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/20211111/43c88a1c/attachment-0001.html>


More information about the llvm-bugs mailing list