[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:45 PDT 2025
================
@@ -347,7 +348,15 @@ int main(int argc, const char **argv) {
}
}
+ // if we add more % commands, there should be better architecture than this
+ const char *help_output = "%help\tlist clang-repl %commands\n"
+ "%undo\tundo the previous input\n"
+ "%quit\texit clang-repl\n";
+ const char *help_prompt = "type %help to list clang-repl commands\n";
----------------
DavidSpickett wrote:
You mention that printing this causes a bunch of tests to fail, which is to be expected but probably a sign we should leave this feature out of this PR. It may be something the maintainer would rather not have, and fixing all the tests in this PR will add a lot of things for us to review.
What you've done is good though, that's what I was thinking of.
I didn't mention it before but gdb does this:
```
$ gdb
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04.2) 12.1
<...>
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) q
$ gdb --quiet
(gdb) q
```
Also clang-repl may want to detect if it's outputting to an interactive terminal or not. Which I did not think of before.
(GDB does not, it expects you to use `--quiet`)
So yeah, leave this bit out so we don't distract from the rest, maybe come back to it in future.
https://github.com/llvm/llvm-project/pull/150348
More information about the cfe-commits
mailing list