[clang] [clang-format] Fix requires misannotation with comma (PR #65908)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 10 13:19:43 PDT 2023
================
@@ -3369,9 +3369,13 @@ bool clang::format::UnwrappedLineParser::parseRequires() {
case tok::kw_volatile:
case tok::kw_const:
case tok::comma:
- FormatTok = Tokens->setPosition(StoredPosition);
- parseRequiresExpression(RequiresToken);
- return false;
+ if (OpenAngles == 0) {
+ FormatTok = Tokens->setPosition(StoredPosition);
+ parseRequiresExpression(RequiresToken);
+ return false;
+ } else {
+ break;
+ }
----------------
HazardyKnusperkeks wrote:
> The former is more consistent with the rest of the `switch` statement, except that there should be no `else` after the `return`. So I would prefer:
>
> ```
> if (OpenAngles == 0) {
> FormatTok = Tokens->setPosition(StoredPosition);
> parseRequiresExpression(RequiresToken);
> return false;
> }
> break;
> ```
Also good, no `else` is my main point.
https://github.com/llvm/llvm-project/pull/65908
More information about the cfe-commits
mailing list