[cfe-dev] Equivalent of KeepEmptyLinesAtTheStartOfBlocks for end of block

Patrick Wolfe via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 14 10:51:01 PDT 2021


Is there a way to tell clang-format​ to keep empty lines at the end of blocks? Currently, our style guide is to have 1 empty line at the start of a multi-line block and 1 at the end. Setting `KeepEmptyLinesAtTheStartOfBlocks` to true stops clang-format​ from removing the initial empty line, but we haven't found a way to stop it from removing the trailing newline. It is not an issue if clang-format​ doesn't automatically apply this style to code that doesn't conform to the style guide, but we'd like to find a way to stop it from editing code that does match it. For reference, what we would like to have is a configuration that allows the following to be unchanged by clang-format​:

```
if (foo) {

    bar();
    baz();

}
```

Thanks!
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210914/874d5a64/attachment.html>


More information about the cfe-dev mailing list