CLANG-CHECK(1)

πŸ“¦
version 21.1.8 Β· 3 versions
, in ubuntu stonking

πŸ’– 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-hidden for more πŸ“–)
  • --help-list β€” prints out a list of all available options (--help-list-hidden for 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-dump or -ast-print and 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-list for 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