[clang] Issue143668 (PR #149396)

Aaron Danen via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 17 13:15:31 PDT 2025


https://github.com/aadanen created https://github.com/llvm/llvm-project/pull/149396

Hi all. This is my first pull request to an open source project. I am a student so have mercy on me!

I have done my best to read all of the relevant documentation about how to contribute most effectively but its totally possible I've made a mistake or missed something. Please let me know so I can do better next time :)

I found a simple issue and have done my best to resolve it. I believe this change resolves #143668 

All i did was grep -r "Too many undos" and replace all instances of that string with the suggested replacement. 

thank you for your time
aadanen

>From f3fbebdd6d940d36561ccf5177510095ba05077e Mon Sep 17 00:00:00 2001
From: Aaron Danen <aaron.danen at gmail.com>
Date: Wed, 16 Jul 2025 19:44:58 -0700
Subject: [PATCH] clarified %undo error msg in clang-repl

used grep -r "Too many undos" to locate all instances where the string
was mentioned. Changed the string to the suggestion in issue 143668
---
 clang/lib/Interpreter/Interpreter.cpp           | 2 +-
 clang/unittests/Interpreter/InterpreterTest.cpp | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index ed3bae59a144c..a2696f78cb510 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -754,7 +754,7 @@ llvm::Error Interpreter::Undo(unsigned N) {
 
   if (N > getEffectivePTUSize())
     return llvm::make_error<llvm::StringError>("Operation failed. "
-                                               "Too many undos",
+                                               "No input left to undo",
                                                std::error_code());
   for (unsigned I = 0; I < N; I++) {
     if (IncrExecutor) {
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp
index b97f5ae17c9f0..2ec65e2a9b2ef 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -158,12 +158,12 @@ TEST_F(InterpreterTest, UndoCommand) {
 
   // Fail to undo.
   auto Err1 = Interp->Undo();
-  EXPECT_EQ("Operation failed. Too many undos",
+  EXPECT_EQ("Operation failed. No input left to undo",
             llvm::toString(std::move(Err1)));
   auto Err2 = Interp->Parse("int foo = 42;");
   EXPECT_TRUE(!!Err2);
   auto Err3 = Interp->Undo(2);
-  EXPECT_EQ("Operation failed. Too many undos",
+  EXPECT_EQ("Operation failed. No input left to undo",
             llvm::toString(std::move(Err3)));
 
   // Succeed to undo.



More information about the cfe-commits mailing list