[llvm-bugs] [Bug 48305] New: clang-format mismatches braces with nested unnamed scopes

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 25 12:29:44 PST 2020


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

            Bug ID: 48305
           Summary: clang-format mismatches braces with nested unnamed
                    scopes
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mateuszalewicki at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Hello.
With clang-format -10 and -11 installed from repo on ubuntu 20.11 following c++
code is obviously formatted wrong:
```
clang-format-11 -style=llvm test.cpp 
void foo() {
  {// asdf
   {int a;
}
}
{
  { int b; }
}
}
```
Removing `{// asdf` is sufficient to format it ok.
I expect it to be formatted like this (possibly with comment in new line, but
this may be llvm style):
```
void foo() {
  {// asdf
    { int a; }
  }
  {
    { int b; }
  }
}

```

-- 
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/20201125/c68b6445/attachment.html>


More information about the llvm-bugs mailing list