summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp3
-rw-r--r--clang/unittests/Format/FormatTest.cpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 0c8ff890491..b3671b30409 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -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;
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index a46c9b685bc..f3da5061f26 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -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) {
OpenPOWER on IntegriCloud