[all-commits] [llvm/llvm-project] 106c48: [clang-format] Improve brace wrapping and add an o...

Sirraide via All-commits all-commits at lists.llvm.org
Sat Jan 18 15:27:03 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 106c483a102e1328f11e2b1d9398f4ad2826b59f
      https://github.com/llvm/llvm-project/commit/106c483a102e1328f11e2b1d9398f4ad2826b59f
  Author: Sirraide <aeternalmail at gmail.com>
  Date:   2025-01-19 (Sun, 19 Jan 2025)

  Changed paths:
    M clang/docs/ClangFormatStyleOptions.rst
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Format/Format.h
    M clang/lib/Format/Format.cpp
    M clang/lib/Format/TokenAnnotator.h
    M clang/lib/Format/UnwrappedLineFormatter.cpp
    M clang/lib/Format/UnwrappedLineParser.cpp
    M clang/lib/Format/UnwrappedLineParser.h
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] Improve brace wrapping and add an option to control indentation of `export { ... }` (#110381)

`export { ... }` blocks can get a bit long, so I thought it would make
sense to have an option that makes it so their contents are not indented
(basically the same argument as for namespaces).

This is based on the `NamespaceIndentation` option, except that there is
no option to control the behaviour of `export` blocks when nested because
nesting them doesn’t really make sense.

Additionally, brace wrapping of short `export { ... }` blocks is now controlled by the
`AllowShortBlocksOnASingleLine` option. There is no separate option just for `export`
blocks because you can just write e.g. `export int x;` instead of `export { int x; }`.

This closes #121723.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list