[clang] [clang-repl] Address error recovery fixing infinite loop while parsing (PR #127569)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 11 01:37:46 PST 2026


================
@@ -2823,7 +2823,13 @@ void PragmaSupportHandler<StartTok, EndTok, UnexpectedDiag>::HandlePragma(
   Tok.setKind(StartTok);
   Tok.setLocation(Introducer.Loc);
 
-  while (Tok.isNot(tok::eod) && Tok.isNot(tok::eof)) {
+  auto IsAtInputEnd = [&PP](const Token &T) {
+    if (PP.getLangOpts().IncrementalExtensions)
+      return T.is(tok::annot_repl_input_end);
+    return T.is(tok::eof);
+  };
----------------
vgvassilev wrote:

Sure, but then the new routine you added in the parser does not depend on the parser state. It can be either static or be put in a shared place.

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


More information about the cfe-commits mailing list