[PATCH] D145642: [clang-format] Annotate lambdas with requires clauses.
Emilia Dreamer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 8 19:31:16 PST 2023
rymiel created this revision.
rymiel added a project: clang-format.
rymiel added reviewers: HazardyKnusperkeks, MyDeveloperDay, owenpan.
Herald added a project: All.
rymiel requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The C++ grammar allows lambdas to have a *requires-clause* in two
places, either directly after the *template-parameter-list*, such as:
`[] <typename T> requires foo<T> (T t) { ... };`
Or, at the end of the *lambda-declarator* (before the lambda's body):
`[] <typename T> (T t) requires foo<T> { ... };`
Previously, these cases weren't handled at all, resulting in weird
results.
Note that this commit only handles token annotation, so the actual
formatting still ends up suboptimal. This is mostly because I do not yet
know how to approach making the requires clause formatting of lambdas
match the formatting for functions.
Fixes https://github.com/llvm/llvm-project/issues/61269
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145642
Files:
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145642.503601.patch
Type: text/x-patch
Size: 8046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230309/b307ae14/attachment-0001.bin>
More information about the cfe-commits
mailing list