[llvm-bugs] [Bug 26626] New: BreakBeforeBraces Allman and AfterEnum false works with just "enum" but fails with "typedef enum"

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 15 15:39:42 PST 2016


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

            Bug ID: 26626
           Summary: BreakBeforeBraces Allman and AfterEnum false works
                    with just "enum" but fails with "typedef enum"
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Rich.Jahn at osii.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

I first tried...

BreakBeforeBraces: Allman

Next I tried...

BreakBeforeBraces: Custom
BraceWrapping:
AfterEnum: true


In both cases there is not a line break before the opening curly brace { of a
typedef enum. There is a line break with just a plain enum.

I think this is inconsistent, because in both cases with a "struct" and
"typedef struct" there is a line break before the before the opening curly
brace {

clang-format.exe test.c
enum E1
{
        option1,
        option2
};
typedef enum E2_tag {
        option3,
        option4
} E2;
struct S1
{
        int field1;
        int field2;
};
typedef struct S2_tag
{
        int field1;
        int field2;
} S2;

In C, it is necessary to use a typedef to avoid having to write "enum" in all
variable declarations. This differs from C++.

-- 
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/20160215/74054344/attachment.html>


More information about the llvm-bugs mailing list