CLANG-CHECK(1)
π CLANG-CHECK β the manual page, bestie edition π
okay so real talk, this is the manual page for clang-check from the User Commands girlies, version 16. she's that girl. let's get into it π«Ά
β¨ NAME β¨
clang-check β manual page for clang-check 16 π
πΈ DESCRIPTION πΈ
USAGE:
clang-check [options] <source0> [... <sourceN>]
OPTIONS:
π¦ Generic Options π¦
--helpβ shows you all the available options. and if you're nosy (same bestie, same) add--help-hiddenfor even more π--help-listβ shows you a list of the available options. and again,--help-list-hiddenif you wanna see the hidden ones too π--versionβ tells you which version of this program you're running. icon behaviour fr β
π clang-check options π
--analyzeβ runs the static analysis engine π₯--analyzer-output-path=<string>β writes the output to<file>π--ast-dumpβ builds ASTs and then debug dumps them π--ast-dump-filter=<string>β use this with-ast-dumpor-ast-printto dump/print only the AST declaration nodes that have a certain substring in a qualified name. and use-ast-listto list all the filterable declaration node names, iykyk π--ast-listβ builds ASTs and prints the list of declaration node qualified names π--ast-printβ builds ASTs and then pretty-prints them. pretty-privilege β¨--extra-arg=<string>β an additional argument to append to the compiler command line β--extra-arg-before=<string>β an additional argument to prepend to the compiler command line β¬ οΈ--fix-what-you-canβ applies fix-it advice even when there are unfixable errors hanging around π©Ή--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 ποΈ
π the build path lore π
-p <build-path> is what you use to read a compile command database.
so for example, it can totally be a CMake build directory where a file named compile_commands.json exists. (use the -DCMAKE_EXPORT_COMPILE_COMMANDS=ON CMake option to get this output, bestie π
). and when no build path is specified, a search for compile_commands.json will be attempted through all parent paths of the first input file.
if you want an example of setting up Clang Tooling on a source tree, it's here:
https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
π the source files π
<source0> ... specify the paths of source files. no cap, these paths are looked up in the compile command database. so 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, 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.
"./" prefixes in the relative files will be automatically removed, but the rest of a relative path must be a suffix of a path in the compile command database. periodt π
π§ examples, because we love a demo π§
for example, to run clang-check on all files in a subtree of the source tree, use:
find path/in/subtree -name '*.cpp'|xargs clang-check
or, using a specific build path:
find path/in/subtree -name '*.cpp'|xargs clang-check -p build/path
β οΈ note that path/in/subtree and the current directory should follow the rules described above. don't skip the rules, they're the rules π
and that's the whole page, bestie. main character manual energy only π
signing off: clang-check 16, October 2023, CLANG-CHECK(1) β mwah, take care of yourselves πβ¨π
π¦ where this page comes from
- debian bookworm: clang-tools-16 1:16.0.6-15~deb12u1 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms