[clang] [clang-repl] adding documentation and information for %commands (PR #150348)

David Spickett via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 29 05:32:43 PDT 2025


================
@@ -370,6 +379,10 @@ int main(int argc, const char **argv) {
       if (Input == R"(%undo)") {
         if (auto Err = Interp->Undo())
           llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+      } else if (Input == R"(%help)") {
+        OS << help_output << '\n';
+      } else if (Input[0] == '%') { // make sure this is evaluated last
+        OS << "Invalid % command: \"" << Input << "\". " << help_prompt;
----------------
DavidSpickett wrote:

For this I think you should handle it as if it were an error that came from an attempt to undo. Except in this case, you'd construct an error yourself and pass that into logAllUnhandledErrors.

https://github.com/llvm/llvm-project/pull/150348


More information about the cfe-commits mailing list