clang-format: Support ObjC's NS_ENUMs.
Before:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anotherDecentlyLongValue.
anotherDecentlyLongValue,
/// Information about aThirdDecentlyLongValue.
aThirdDecentlyLongValue};
After:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anotherDecentlyLongValue.
anotherDecentlyLongValue,
/// Information about aThirdDecentlyLongValue.
aThirdDecentlyLongValue
};
llvm-svn: 200469
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 9b0a11c..93e3f7a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1713,6 +1713,18 @@
verifyFormat("enum X : std::uint32_t { A, B };");
}
+TEST_F(FormatTest, FormatsNSEnums) {
+ verifyGoogleFormat("typedef NS_ENUM(NSInteger, SomeName) { AAA, BBB }");
+ verifyGoogleFormat("typedef NS_ENUM(NSInteger, MyType) {\n"
+ " // Information about someDecentlyLongValue.\n"
+ " someDecentlyLongValue,\n"
+ " // Information about anotherDecentlyLongValue.\n"
+ " anotherDecentlyLongValue,\n"
+ " // Information about aThirdDecentlyLongValue.\n"
+ " aThirdDecentlyLongValue\n"
+ "};");
+}
+
TEST_F(FormatTest, FormatsBitfields) {
verifyFormat("struct Bitfields {\n"
" unsigned sClass : 8;\n"