https://github.com/dyung created 
https://github.com/llvm/llvm-project/pull/230734

Reverts llvm/llvm-project#230054

This is causing a test failure on a Windows bot: 
https://lab.llvm.org/buildbot/#/builders/46/builds/42541

>From 218198690322b27dc2386759ad3e660551d286db Mon Sep 17 00:00:00 2001
From: Douglas Yung <[email protected]>
Date: Fri, 9 Oct 2026 21:49:56 -0700
Subject: [PATCH] Revert "[clang-repl] Fix crashing on unusable top-level
 declarations (#230054)"

This reverts commit 6e92994f7a95d11cf450f6bec62104a0028b83cb.
---
 clang/lib/Parse/ParseDecl.cpp      | 4 +---
 clang/test/Interpreter/execute.cpp | 4 ----
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index a3567d618cfa52..2f326451c3f13d 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -5873,10 +5873,8 @@ Parser::DeclGroupPtrTy Parser::ParseTopLevelStmtDecl() {
   TopLevelStmtDecl *TLSD = Actions.ActOnStartTopLevelStmtDecl(getCurScope());
   StmtResult R = ParseStatementOrDeclaration(Stmts, SubStmtCtx);
   Actions.ActOnFinishTopLevelStmtDecl(TLSD, R.get());
-  if (!R.isUsable()) {
+  if (!R.isUsable())
     R = Actions.ActOnNullStmt(Tok.getLocation());
-    TLSD->setStmt(R.get());
-  }
 
   if (Tok.is(tok::annot_repl_input_end) &&
       Tok.getAnnotationValue() != nullptr) {
diff --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index 65dbc2d70a90f1..82cd70a93980a7 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -19,7 +19,3 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, 
reinterpret_cast<unsigned long long
 
 inline int foo() { return 42; }
 int r3 = foo();
-
-return;
-printf("not crashed\n");
-// CHECK-NEXT: not crashed

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to