[clang-format] Set requires expression params as not an expression
authorEmilia Dreamer <emilia@rymiel.space>
Fri, 23 Dec 2022 00:22:10 +0000 (02:22 +0200)
committerEmilia Dreamer <emilia@rymiel.space>
Fri, 23 Dec 2022 00:22:48 +0000 (02:22 +0200)
commit0ebed862d82134e7a8e42d8dc7944afe765445ba
treeb584ba3cd4c6fcfecbbee1332e6fe9ee5a5989a5
parentba4caec64fec457b4ab20876a809b45162b048f4
[clang-format] Set requires expression params as not an expression

Previously, the parens of a requires expression's "parameters" were not
explicitly set, meaning they ended up as whatever the outer scope was.
This is a problem in some cases though, since the process of determining
star/amp checks if the token is inside of an expression context

This patch always makes sure the context between those parens are always
set to not be an expression

Fixes https://github.com/llvm/llvm-project/issues/59600

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D140330
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp