[all-commits] [llvm/llvm-project] 4cf9a4: [clang-format] Adjust requires clause wrapping (#1...

Nathan Sidwell via All-commits all-commits at lists.llvm.org
Fri Aug 16 18:05:30 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4cf9a4266167c686e7e405ead5d6c1cd389eeca5
      https://github.com/llvm/llvm-project/commit/4cf9a4266167c686e7e405ead5d6c1cd389eeca5
  Author: Nathan Sidwell <nathan at acm.org>
  Date:   2024-08-16 (Fri, 16 Aug 2024)

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

  Log Message:
  -----------
  [clang-format] Adjust requires clause wrapping (#101550) (#102078)

Address #101550 by adding OwnLineWithBrace option for RequiresClausePosition. This permits placing a following '{' on the same line as the requires clause.

Thus, instead of:
```
bool Foo ()
  requires(true)
{
  return true;
}
```

we have:
```
bool Foo ()
  requires(true) {
  return true;
}
```

If the function body is empty, we'll get:
```
bool Foo ()
  requires(true) {}
```

I attempted to get a line break between the open and close braces, but
failed. Perhaps that's fine -- it's rare and only happens in the empty
body case.



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