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

Anutosh Bhat via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 10 23:54:08 PST 2026


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

>From 5bda5cb946e8056a43e487e66487632729d37aee Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Tue, 18 Feb 2025 11:23:30 +0530
Subject: [PATCH] Address error recovery fixing infinite loop while parsing

---
 clang/lib/Parse/ParseStmt.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index cd4504630f871..a044c8acab927 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -1253,7 +1253,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
 
   bool LastIsError = false;
   while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
-         Tok.isNot(tok::eof)) {
+         Tok.isNot(tok::eof) && Tok.isNot(tok::annot_repl_input_end)) {
     if (Tok.is(tok::annot_pragma_unused)) {
       HandlePragmaUnused();
       continue;



More information about the cfe-commits mailing list