[SERVER-76921] toolchain v4 clang-format unaware of C++20 `requires` clauses Created: 08/May/23 Updated: 25/Aug/23 Resolved: 08/May/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Server Development Platform
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
I'm deploying C++20 `requires` clauses as expansions of the corresponding `concepts.h` macros. https://github.com/10gen/mongo/pull/12708 As you can see in the PR, the `requires` clauses are not handled gracefully by our version of clang-format. This may be just our config options, but it's more likely that we will need a more modern version of clang-format for this C++20 feature. Example: What our clang-format.py produces: Incorrect indentation:
Merging requires clause with function signature:
It probably considers the `requires` clause to be grammatically part of the function's return type or something like that. Proper modern formatting (per https://gcc.godbolt.org/z/vabc8aqnr):
|