[clang] [clang-format] Add `TT_CompoundRequirementLBrace` for better annotation (PR #121539)

Emilia Kond via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 4 06:32:33 PST 2025


rymiel wrote:

This is a good fix but I think it might not be addressing the whole issue. This isn't a problem with just *compound-requirement*, it's the case for *simple-requirement*s too.

This is valid:
```c++
template <typename T>
concept Multiplicable = requires(T a, T b) { a * b; };
```
but clang-format produces this:
```c++
template <typename T>
concept Multiplicable = requires(T a, T b) { a *b; };
```
Even with this patch applied.

I'm not exactly sure what clang-format is doing here and how this wasn't caught earlier. I guess it thinks the contents of a requires expression aren't an expression context but it typically is.

https://github.com/llvm/llvm-project/pull/121539


More information about the cfe-commits mailing list