[clang] [clang][Preprocessor] Add peekNextPPToken, makes look ahead next token without side-effects (PR #143898)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 12 08:44:51 PDT 2025


================
@@ -2288,7 +2288,9 @@ class Preprocessor {
   /// Determine whether the next preprocessor token to be
   /// lexed is a '('.  If so, consume the token and return true, if not, this
   /// method should have no observable side-effect on the lexed tokens.
-  bool isNextPPTokenLParen();
+  bool isNextPPTokenLParen() {
+    return peekNextPPToken().value_or(Token{}).is(tok::l_paren);
----------------
cor3ntin wrote:

I don't like that we are creating a new token everytime - I'm not sure that it matters though

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


More information about the cfe-commits mailing list