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

Reply via email to