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

            Bug ID: 48663
           Summary: "strange" brace wrapping of block regarding
                    afterfunction/aftercontrolstatement options
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Created attachment 24351
  --> https://bugs.llvm.org/attachment.cgi?id=24351&action=edit
actual config files used (both config are in the file)

I found an inconstant behavior/interaction between the two options of
BraceWrapping
  AfterFunction
  AfterControlStatement
Maybe I misunderstand something, but the behavior differ from clang-format-9 I
use to have. Complete config as attachment.
Maybe related to/duplicated of 47936
(https://bugs.llvm.org/show_bug.cgi?id=47936)

The strange output is when 
BraceWrapping:
  AfterControlStatement: Always
  AfterFunction:   false

```
for (int i = 0; i < 10; i++)
{ c++; }
if (i)
{ d++; }
```

I would expect the same output as (which is what I obtain with clang-format-9,
with the config above), but I do not want to have break after functions.
BraceWrapping:
  AfterControlStatement: Always
  AfterFunction:   true

```
for (int i = 0; i < 10; i++)
{
  c++;
}

if (i)
{
  d++;
}
```

note that these looks fine, but are not my intent.
BraceWrapping:
  AfterControlStatement: Never
  AfterFunction:   false/true
```
for (int i = 0; i < 10; i++){
    c++;
}
if (i) {
    d++;
}
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to