forked from OSchip/llvm-project
clang-format: Don't remove empty lines at the start of namespaces.
llvm-svn: 204462
This commit is contained in:
parent
3df5d87da4
commit
01b35482e5
|
@ -889,7 +889,8 @@ private:
|
|||
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.
|
||||
|
|
|
@ -174,6 +174,16 @@ TEST_F(FormatTest, RemovesEmptyLines) {
|
|||
"\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"
|
||||
|
|
Loading…
Reference in New Issue