Skip to content

Commit b0513a8

Browse files
committed
implemented contextual error msg
differentiate between the case of 0 inputs to undo and the case when there are X inputs and Y requested undos but Y > X
1 parent 0b809e9 commit b0513a8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clang/lib/Interpreter/Interpreter.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,10 +752,17 @@ Interpreter::getSymbolAddressFromLinkerName(llvm::StringRef Name) const {
752752

753753
llvm::Error Interpreter::Undo(unsigned N) {
754754

755-
if (N > getEffectivePTUSize())
755+
if (getEffectivePTUSize() == 0) {
756756
return llvm::make_error<llvm::StringError>("Operation failed. "
757757
"No input left to undo",
758758
std::error_code());
759+
} else if (N > getEffectivePTUSize()) {
760+
return llvm::make_error<llvm::StringError>(
761+
llvm::formatv("Wanted to undo {0} inputs, only have {1}.",
762+
N, getEffectivePTUSize()),
763+
std::error_code());
764+
}
765+
759766
for (unsigned I = 0; I < N; I++) {
760767
if (IncrExecutor) {
761768
if (llvm::Error Err = IncrExecutor->removeModule(PTUs.back()))

0 commit comments

Comments
 (0)