<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/143668>143668</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-repl %undo message is misleading when there is nothing left to undo
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DavidSpickett
</td>
</tr>
</table>
<pre>
This is the smallest problem but it might be a good first time contributor issue so I'm reporting it anyway.
Start clang-repl and immediately `%undo`:
```
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build>.\bin\clang-repl
clang-repl> %undo
error: Operation failed. Too many undos
```
Would be nice if this could tell it had reached the top (or bottom?) of the undo stack and customise the error to say that instead.
```
error: Operation failed. No input left to undo.
```
Here's a longer example that shows building a set of lines and undo-ing back to the beginning:
```
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build>.\bin\clang-repl
clang-repl> int i = 1;
clang-repl> int j = i + 1;
clang-repl> %undo
clang-repl> int k = j + 1;
In file included from <<< inputs >>>:1:
input_line_3:1:9: error: use of undeclared identifier 'j'
1 | int k = j + 1;
| ^
error: Parsing failed.
clang-repl> %undo
clang-repl> int l = i + 1;
input_line_4:1:9: error: use of undeclared identifier 'i'
1 | int l = i + 1;
| ^
error: Parsing failed.
clang-repl> %undo
error: Operation failed. Too many undos
clang-repl>
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVc1u4zYQfhr6MrAhUZa0PujgODG6l7bAbtHjghJH0iQUKZCjuH77grTTuNm0wOayAgGRHM7P981wqEKgwSI2orwT5f1KLTw639yrZ9JfZuqekHnVOn1uvo4UgALwiBAmZQwGhtm71uAE7cJADBMNI0OLoGBwTkNPPjAwTQids-ypXdh5oBAWhODgs5D1BB5n55nsEE0oez6p80Zke5Htv7DyDJ1Rdlh7nA0oq4GmCTUpRnMGUWVClovVLs6KqBMnl5HtD3GrPPwR0AdR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