[llvm] [llvm] terminate namespace with closing comment (PR #94917)
Owen Pan via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 20:44:49 PDT 2024
owenca wrote:
This is a limitation of clang-format:
```
$ cat .clang-format
BasedOnStyle: LLVM
$ cat test.cpp
namespace {
int i;
int j;
}
$ clang-format -version
clang-format version 18.1.7
$ clang-format test.cpp | diff test.cpp -
2,4c2,4
< int i;
< int j;
< }
---
> int i;
> int j;
> } // namespace
$ clang-format -lines=4:4 test.cpp | diff test.cpp -
4c4
< }
---
> } // namespace
$
```
You can work around this by fixing the indentation of the lines within the namespace in the same patch:
```
$ clang-format -lines=2:3 -i test.cpp
$ cat test.cpp
namespace {
int i;
int j;
}
$ clang-format -lines=4:4 test.cpp | diff test.cpp -
4c4
< }
---
> } // namespace
$
```
https://github.com/llvm/llvm-project/pull/94917
More information about the llvm-commits
mailing list