[clang] [NFC][Clang][Preprocessor] Refine the implementation of isNextPPTokenOneOf (PR #145546)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 24 09:33:30 PDT 2025


================
@@ -101,11 +101,8 @@ class Token {
   /// "if (Tok.is(tok::l_brace)) {...}".
   bool is(tok::TokenKind K) const { return Kind == K; }
   bool isNot(tok::TokenKind K) const { return Kind != K; }
-  bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const {
-    return is(K1) || is(K2);
-  }
   template <typename... Ts> bool isOneOf(tok::TokenKind K1, Ts... Ks) const {
-    return is(K1) || isOneOf(Ks...);
+    return is(K1) || (is(Ks) || ...);
----------------
erichkeane wrote:

This is better, thanks!  it is strange we got away with this as long as we did!  

https://github.com/llvm/llvm-project/pull/145546


More information about the cfe-commits mailing list