CLANG-CHECK(1)
π NAME π
clang-check β bestie, this is the manual page for clang-check 21 β¨ (she lives in the User Commands section of your manual, iykyk)
πΈ DESCRIPTION πΈ
Okay so here's the whole vibe β the usage goes like this:
USAGE: clang-check [options] <source0> [... <sourceN>]
And now, the OPTIONS π
π Generic Options π
These are the universal girlypops, available to everyone:
--helpβ shows you all the available options (and if you want the secret extras, it's--help-hiddenfor more π)--help-listβ prints out a list of all available options (--help-list-hiddenfor more π)--versionβ tells you which version of this program you're running, cute and simple π
π¦ clang-check options π¦
The main character options, right this way:
--analyzeβ runs the static analysis engine π--analyzer-output-path=<string>β writes output to <file> π--ast-dumpβ builds ASTs and then debug-dumps them--ast-dump-filter=<string>β team up with-ast-dumpor-ast-printand it will only dump/print the AST declaration nodes that have a certain substring in a qualified name. Wanna see all the filterable declaration node names? Use-ast-listfor that π--ast-listβ builds ASTs and prints the list of declaration node qualified names π--ast-printβ builds ASTs and then pretty-prints them, aesthetic β¨--extra-arg=<string>β an extra argument to append to the compiler command line--extra-arg-before=<string>β an extra argument to prepend to the compiler command line (she goes first, main character energy π)--fix-what-you-canβ applies fix-it advice even when there are unfixable errors hanging around. She does what she can π«Ά--fixitβ applies fix-it advice to the input source-p <string>β build path ποΈ--syntax-tree-dumpβ dumps the syntax tree π³--tokens-dumpβ dumps the preprocessed tokens π
π About that -p <build-path> thing π
So -p <build-path> is what you use to read a compile command database, no cap.
For example β it can be a CMake build directory where a file called compile_commands.json exists. (Pro tip from the manpage itself: use the -DCMAKE_EXPORT_COMPILE_COMMANDS=ON CMake option to get that output.) And when you don't specify a build path at all, it goes on a little quest π β it searches for compile_commands.json through all parent paths of the first input file. For an example of setting up Clang Tooling on a source tree, see:
https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
π§ About <source0> ... π§
<source0> ... is where you specify the paths of your source files. These paths get looked up in the compile command database. Here's the tea β:
- If the path of a file is absolute, it needs to point into CMake's source tree.
- If the path is relative, then the current working directory needs to be in the CMake source tree, and the file must be in a subdirectory of the current working directory.
- Any
"./"prefixes in the relative files get automatically removed β but the rest of a relative path has to be a suffix of a path in the compile command database. Respect the rules bestie πΈ
For example, to run clang-check on all the files in a subtree of the source tree, you'd do:
find path/in/subtree -name '*.cpp'|xargs clang-check
Or, if you're using a specific build path:
find path/in/subtree -name '*.cpp'|xargs clang-check -p build/path
Heads up π β path/in/subtree and the current directory both need to follow all those rules we just described above. Don't skip that part, fr fr.
Okay that's literally the whole page, slay π
π thanks for reading, now go run clang-check on something and feel iconic.
β§ο½₯οΎ: β§ο½₯οΎ: This was clang-check 21, from September 2026 β manual page CLANG-CHECK(1) β¨π¦πΈ :ο½₯οΎβ§:ο½₯οΎβ§
π¦ where this page comes from
- ubuntu stonking: clang-tools-21 1:21.1.8-10ubuntu2 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms