Newlines = 1;
// Remove empty lines after "{".
- if (PreviousLine && PreviousLine->Last->is(tok::l_brace))
+ if (PreviousLine && PreviousLine->Last->is(tok::l_brace) &&
+ PreviousLine->First->isNot(tok::kw_namespace))
Newlines = 1;
// Insert extra new line before access specifiers.
"\n"
"};"));
+ // Don't remove empty lines at the start of namespaces.
+ EXPECT_EQ("namespace N {\n"
+ "\n"
+ "int i;\n"
+ "}",
+ format("namespace N {\n"
+ "\n"
+ "int i;\n"
+ "}"));
+
// Remove empty lines at the beginning and end of blocks.
EXPECT_EQ("void f() {\n"
" if (a) {\n"