Issue 146317
Summary [clang-format] Incorrect Formatting Between clang-format off and clang-format on
Labels clang-format
Assignees
Reporter rocfu
    ### Title: Incorrect Formatting Between clang-format off and clang-format on

Here is a snippet of isolated and formatted C++ code, but in my configuration, it causes the section between "clang-format off" and "clang-format on" to be formatted. It seems that the SeparateDefinitionBlocks option doesn't prevent formatting and still triggers it before the // clang-format on section.

```cpp
// clang-format off
void function()
{

}
// clang-format on
```

The formatting result adds an extra line between the function and the // clang-format on comment:
```cpp
// clang-format off
void function()
{

}

// clang-format on
```

My environment:
* clang-format version 17.0.6 and version 18.1.4

.clang-format configuration:
```
Language: Cpp
SeparateDefinitionBlocks: Always
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to