[clang] [clang-format][NFC] Introduce isNotOneOf (PR #161021)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 27 20:43:53 PDT 2025
================
@@ -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:
For pointers, I prefer `!(Next && Next->isOneOf(A, B)` to `!Next || Next->isNotOneOf(A, B)` because the `Next &&` part is just for avoiding dereferencing a null pointer.
https://github.com/llvm/llvm-project/pull/161021
More information about the cfe-commits
mailing list