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

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 12 09:47:46 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);
----------------
yronglin wrote:

Cool! This looks good to me, let me give a try.

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


More information about the cfe-commits mailing list