Skip to content
Snippets Groups Projects
Commit 1774603d authored by Daniel Jasper's avatar Daniel Jasper
Browse files

Format unions like structs and classes.

Note that I don't know whether we should put {} on a single line in this
case, but it is probably a theoretical issue as in practice such
structs, classes or unions won't be empty.

Before: union A {}
        a;
After:  union A {} a;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172355 91177308-0d34-0410-b5e6-96231b3b80d8
parent 700d4e44
No related branches found
No related tags found
No related merge requests found
......@@ -317,7 +317,8 @@ void UnwrappedLineParser::parseStructuralElement() {
case tok::kw_enum:
parseEnum();
return;
case tok::kw_struct: // fallthrough
case tok::kw_struct: // fallthrough
case tok::kw_union: // fallthrough
case tok::kw_class:
parseStructClassOrBracedList();
return;
......
......@@ -343,6 +343,7 @@ TEST_F(FormatTest, FormatsDerivedClass) {
TEST_F(FormatTest, FormatsVariableDeclarationsAfterStructOrClass) {
verifyFormat("class A {} a, b;");
verifyFormat("struct A {} a, b;");
verifyFormat("union A {} a;");
}
TEST_F(FormatTest, FormatsEnum) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment