[llvm-bugs] [Bug 26689] New: Clang-format Does not Break Before Brace After `Extern "c"` With Setting `BreakBeforeBraces: Allman`

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 22 03:23:39 PST 2016


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

            Bug ID: 26689
           Summary: Clang-format Does not Break Before Brace After `Extern
                    "c"` With Setting `BreakBeforeBraces: Allman`
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sanssecours at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Clang-Format does not add a break before a opening brace after `extern "C"` if
the setting `BreakBeforeBraces` is set to `Allman`. This is not the expected
behaviour, since official documentation [1] states, that Clang-Format always
breaks before braces if we use this option.

Example: If we save the code

```cpp
extern "C" 
{
  int foo() 
  {
    return 1;
  }
}
```

in a file called `extern.cpp` and format it using `clang-format
-style='{BreakBeforeBraces: Allman}' extern.cpp`, then `clang-format` prints
the following:

```cpp
extern "C" {
int foo() { return 1; }
}
```

However, the expected result is

```cpp
extern "C" 
{
int foo() { return 1; }
}
```

or

```cpp
extern "C" 
{
  int foo() { return 1; }
}
```

[1]: http://clang.llvm.org/docs/ClangFormatStyleOptions.html

-- 
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/20160222/2887622e/attachment.html>


More information about the llvm-bugs mailing list