Home / Alt manpages / clang-repl-20(1)

  • clang-repl-20(1)
  • User command
  • linux

Test clang-repl 20 Safely and Spot an Incomplete Build

The clang-repl-20 binary runs, prints a cheerful message and exits with status 0, and still does not evaluate a single line of C++. This guide shows you what the installed command really does, gives you a harmless smoke test, and tells a working C++ interpreter from a package that only exposes the command-line shell.

Allow about ten minutes. You need a shell and the clang-tools-20 package. None of the checks below needs sudo.

1. Confirm the installed command and package

Check the path and the version first. The package used for these examples is Debian's clang-tools-20, version 1:20.1.8~++20250804090239+87f0227cb601-1~exp1~20250804210352.139. The executable identifies itself as LLVM 20.1.8.

$ command -v clang-repl-20
/usr/bin/clang-repl-20
$ clang-repl-20 --version
Ubuntu LLVM version 20.1.8
  Optimized build.

The installed manual page is for clang-repl 20 and documents the usage form clang-repl [options] [code to run]. Its option list is largely the common Clang and LLVM set. It offers no separate tutorial or input grammar, and no guarantee that every advertised interpreter feature is enabled in this build.

Checkpoint

You should have a versioned executable at a known path before you test any C++ input.

2. Run a version-only check

--version only prints metadata. It does not compile or execute code, which makes it the safest first command on a machine you did not configure yourself:

$ clang-repl-20 --version
Ubuntu LLVM version 20.1.8
  Optimized build.

Tip

Do not infer interpreter support from this output. A version string proves the executable started, not that the incremental compiler and JIT can process input.

3. Feed it one small expression

The upstream LLVM documentation describes Clang-Repl as an interactive C++ interpreter. It shows a prompt named clang-repl>, automatic printing for an expression without a semicolon, and special commands such as %help and %quit. Test the smallest useful expression through standard input, without creating or changing a file:

$ printf '%s\n' '1 + 2' | clang-repl-20
Not implement yet.

On the installed 20.1.8 package, that output is the result of the smoke test. The process returns status 0, but it does not print the expected value 3. Treat this as a failed capability check even though the shell status is successful.

If a script needs to record the status, capture it immediately:

$ set +e
$ printf '%s\n' '1 + 2' | clang-repl-20
Not implement yet.
$ status=$?
$ printf 'clang-repl exit status: %s\n' "$status"
clang-repl exit status: 0

Checkpoint

A zero status here only means the process completed its current implementation path. It is not proof the expression was evaluated.

4. Separate command-line options from REPL commands

The manpage documents long options such as --help, --version, the output-colour switch, and --Xcc=<string>. These are process options, supplied to the executable. The upstream percent-prefixed commands are input for a functioning REPL, not shell options.

To check whether the installed executable exposes a usable help path:

$ clang-repl-20 --help | sed -n '1,12p'
USAGE: clang-repl-20 [options] [code to run]

OPTIONS:

Color Options:

  --color                                                    - Use colors in output (default=autodetect)

Tip

Do not use %help in place of --help in an automated shell test. On this installed command it is parsed as input rather than handled as a built-in command, and the output includes a parsing error.

5. Decide whether the package is suitable

Read the smoke-test result and pick a branch:

  • It printed 3 or another evaluated result. Carry on with interactive C++ experiments. Start with declarations and expressions that do not touch the filesystem, network, credentials or production services.
  • It printed Not implement yet. Stop treating this executable as a working REPL. Record the exact version, package version, command path and smoke-test output. Check your distribution's package tracker or LLVM packaging notes, then compare against a package or build that includes the interpreter implementation.

Warning

Keep each session disposable. The interpreter executes native code, so pasted C++ has the same trust boundary as a compiled helper program.

Do not work around the failure with random compiler flags. --Xcc forwards an argument to Clang's compiler invocation, but it cannot add missing interpreter code.

For a locally built LLVM checkout, the official documentation gives a build route that enables the Clang project and builds the clang-repl target. Keep that build separate from the system package until its smoke test succeeds. A replacement may change compiler discovery, ABI assumptions and library search paths, so it is not a harmless system-wide upgrade.

6. Keep the diagnostic reproducible

Save text output rather than changing the system while you investigate:

$ {
>   command -v clang-repl-20
>   clang-repl-20 --version
>   printf '%s\n' '1 + 2' | clang-repl-20
> } 2>&1 | tee clang-repl-smoke.log
/usr/bin/clang-repl-20
Ubuntu LLVM version 20.1.8
  Optimized build.
Not implement yet.

The log is ordinary diagnostic data. No elevated privileges are needed to create or remove it.

Warning

Remove the log with rm -- clang-repl-smoke.log only when you no longer need it. The deletion is irreversible, so copy it to your issue tracker first if the package needs investigation.

Done means

  • Facts recorded. The executable path, LLVM version and installed package version are written down.
  • Smoke test run. A harmless expression went through standard input.
  • Output checked. You read the output as well as the exit status.
  • Verdict is honest. Not implement yet. counts as an incomplete interpreter, not successful evaluation.
  • Replacements isolated. Any replacement build stays separate until its own smoke test prints an evaluated result.