[clang] [clang-format][NFC] Introduce isNotOneOf (PR #161021)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 29 23:25:20 PDT 2025
=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>,
=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/161021 at github.com>
================
@@ -1877,8 +1880,9 @@ struct AdditionalKeywords {
// In Verilog the colon in a default label is optional.
return Tok.is(TT_CaseLabelColon) ||
(Tok.is(tok::kw_default) &&
- !(Next && Next->isOneOf(tok::colon, tok::semi, kw_clocking, kw_iff,
- kw_input, kw_output, kw_sequence)));
+ (!Next ||
+ Next->isNotOneOf(tok::colon, tok::semi, kw_clocking, kw_iff,
+ kw_input, kw_output, kw_sequence)));
----------------
owenca wrote:
> But if that's the last thing, I can change it back.
Yes, please. This is also the style in `isVerilogHierarchy()` above. We can have another NFC patch for whichever style the majority of active clang-format contributors wants.
Right now, we have both styles in the clang-format codebase. For example:
```c++
!(Tok && Tok->is(tok::comma))
!(Tok && Tok->isOneOf(tok::comma, tok::period))
```
vs.
```c++
(!Tok || Tok->isNot(tok::comma))
(!Tok || Tok->isNotOneOf(tok::comma, tok::period))
```
@mydeveloperday @sstwcw @gedare do you have a preference on this?
https://github.com/llvm/llvm-project/pull/161021
More information about the cfe-commits
mailing list