clang-format: Don't remove newline if macro ends in access specifier.
I.e.:
#define A public:
// The new line before this line would be removed.
int a;
llvm-svn: 231636
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index fcfe977..7221ec8 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1930,6 +1930,30 @@
"\n"
" void f();\n"
"};"));
+
+ // Even ensure proper spacing inside macros.
+ EXPECT_EQ("#define B \\\n"
+ " class A { \\\n"
+ " protected: \\\n"
+ " public: \\\n"
+ " void f(); \\\n"
+ " };",
+ format("#define B \\\n"
+ " class A { \\\n"
+ " protected: \\\n"
+ " \\\n"
+ " public: \\\n"
+ " \\\n"
+ " void f(); \\\n"
+ " };",
+ getGoogleStyle()));
+ // But don't remove empty lines after macros ending in access specifiers.
+ EXPECT_EQ("#define A private:\n"
+ "\n"
+ "int i;",
+ format("#define A private:\n"
+ "\n"
+ "int i;"));
}
TEST_F(FormatTest, FormatsClasses) {