[llvm-bugs] [Bug 48663] New: "strange" brace wrapping of block regarding afterfunction/aftercontrolstatement options

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 5 03:25:28 PST 2021


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: unassignedclangbugs at nondot.org
          Reporter: david.vanderhaeghe at irit.fr
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210105/6c14554c/attachment.html>


More information about the llvm-bugs mailing list