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: unassignedclangb...@nondot.org
          Reporter: sansseco...@gmail.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to