[llvm-bugs] [Bug 41086] New: Block after case/default label is unindented one level

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 15 08:15:12 PDT 2019


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

            Bug ID: 41086
           Summary: Block after case/default label is unindented one level
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andysem at mail.ru
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

For some reason clang-format unindents code blocks after `case` or `default`
labels one level, and there seems to be no way to configure that. My desired
formatting style is like this:

```
switch (i)
{
case 1:
    x = 10;
    break;

case 2:
    {
        x = 20;
    }
    break;
}
```

In other words, I need `case`/`default` labels to be unindented one level and
the code after the labels to be indented one level, whether or not that code
includes a code block.

In practice the second `case` gets always unindented like this:

```
switch (i)
{
case 1:
    x = 10;
    break;

case 2:
{
    x = 20;
}
break;
}
```

Please, add an option to fix this.

-- 
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/20190315/2e1cfdb0/attachment.html>


More information about the llvm-bugs mailing list