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

David Spickett via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 30 02:02:50 PDT 2025


================
@@ -189,21 +202,40 @@ Using Dynamic Library:
    clang++-17  -c -o print.o print.cpp
    clang-17 -shared print.o -o print.so
 
-Comments:
-=========
+Undo:
+=====
+The `%undo` command reverts the previous input.
 
 .. code-block:: text
 
-   clang-repl> // Comments in Clang-Repl
-   clang-repl> /* Comments in Clang-Repl */
+   clang-repl> int a = 1; a
+   (int) 1
+   clang-repl> %undo
+   clang-repl> a
+   In file included from <<< inputs >>>:1:
+   input_line_2:1:1: error: use of undeclared identifier 'a'
+   1 | a
+   * | ^
+   error: Parsing failed.
 
 
-Closure or Termination:
+Quit:
 =======================
+The `%quit` command terminates clang-repl.
 
 .. code-block:: text
 
-   clang-repl>%quit
+   clang-repl> %quit
+
+Comments:
----------------
DavidSpickett wrote:

I will look at the doc as a whole before approving, but this comments section now feels orphaned down here.

I would move it up to before the commands, because that section feels like "here's C and C++ stuff you can input". Then the commands follow that, and commands are the opposite of C or C++ input.

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


More information about the cfe-commits mailing list