summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorBen Hamilton <benhamilton@google.com>2019-07-22 18:20:01 +0000
committerBen Hamilton <benhamilton@google.com>2019-07-22 18:20:01 +0000
commitd9212ef77b927f634b43f30289e75fa3f16df3f0 (patch)
tree6f58bec8d0e2d50aae6f84b23d24fe6ac5e6e607 /clang/unittests/Format/FormatTest.cpp
parent4138b2f16760f2b0be4008d68284dc1f97dbd5bd (diff)
downloadbcm5719-llvm-d9212ef77b927f634b43f30289e75fa3f16df3f0.tar.gz
bcm5719-llvm-d9212ef77b927f634b43f30289e75fa3f16df3f0.zip
Adds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and CF_ENUM.
Summary: Addresses the formatting of NS_CLOSED_ENUM and CF_CLOSED_ENUM, introduced in Swift 5. Before: ``` typedef NS_CLOSED_ENUM(NSInteger, Foo){FooValueOne = 1, FooValueTwo, FooValueThree}; ``` After: ``` typedef NS_CLOSED_ENUM(NSInteger, Foo) { FooValueOne = 1, FooValueTwo, FooValueThree }; ``` Contributed by heijink. Reviewers: benhamilton, krasimir Reviewed By: benhamilton Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65012 llvm-svn: 366719
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index c1cec110137..463b9213a04 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1716,6 +1716,8 @@ TEST_F(FormatTest, FormatsTypedefEnum) {
TEST_F(FormatTest, FormatsNSEnums) {
verifyGoogleFormat("typedef NS_ENUM(NSInteger, SomeName) { AAA, BBB }");
+ verifyGoogleFormat(
+ "typedef NS_CLOSED_ENUM(NSInteger, SomeName) { AAA, BBB }");
verifyGoogleFormat("typedef NS_ENUM(NSInteger, MyType) {\n"
" // Information about someDecentlyLongValue.\n"
" someDecentlyLongValue,\n"
@@ -1724,6 +1726,14 @@ TEST_F(FormatTest, FormatsNSEnums) {
" // Information about aThirdDecentlyLongValue.\n"
" aThirdDecentlyLongValue\n"
"};");
+ verifyGoogleFormat("typedef NS_CLOSED_ENUM(NSInteger, MyType) {\n"
+ " // Information about someDecentlyLongValue.\n"
+ " someDecentlyLongValue,\n"
+ " // Information about anotherDecentlyLongValue.\n"
+ " anotherDecentlyLongValue,\n"
+ " // Information about aThirdDecentlyLongValue.\n"
+ " aThirdDecentlyLongValue\n"
+ "};");
verifyGoogleFormat("typedef NS_OPTIONS(NSInteger, MyType) {\n"
" a = 1,\n"
" b = 2,\n"
@@ -1734,6 +1744,11 @@ TEST_F(FormatTest, FormatsNSEnums) {
" b = 2,\n"
" c = 3,\n"
"};");
+ verifyGoogleFormat("typedef CF_CLOSED_ENUM(NSInteger, MyType) {\n"
+ " a = 1,\n"
+ " b = 2,\n"
+ " c = 3,\n"
+ "};");
verifyGoogleFormat("typedef CF_OPTIONS(NSInteger, MyType) {\n"
" a = 1,\n"
" b = 2,\n"
OpenPOWER on IntegriCloud