llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.24k stars 11.66k forks source link

clang-format: "KeepEmptyLinesAtTheStartOfBlocks: false" not respected for namespaces #57713

Open Ayxan13 opened 2 years ago

Ayxan13 commented 2 years ago

In clang-format-12, KeepEmptyLinesAtTheStartOfBlocks: false removes the empty space at the top of a namespace. Starting with clang-format-13 (including 14, 15, 16) this option is no longer effective:

$ cat test.cpp
namespace {

    int i = 0;
}
$ cat .clang-format
---
BasedOnStyle: Microsoft
KeepEmptyLinesAtTheStartOfBlocks: false
---
$ clang-format-12 -style=file ./test.cpp
namespace
{
int i = 0;
}
$ clang-format-13 -style=file ./test.cpp
namespace
{

int i = 0;
}
$ clang-format-14 -style=file ./test.cpp
namespace
{

int i = 0;
}
$ clang-format-15 -style=file ./test.cpp
namespace
{

int i = 0;
}
$ clang-format-16 -style=file ./test.cpp
namespace
{

int i = 0;
}
llvmbot commented 2 years ago

@llvm/issue-subscribers-clang-format