CLANG-QUERY(1)
π NAME π
clang-query β bestie, it's literally the manual page for clang-query 18 β¨
π¦ DESCRIPTION π¦
okay so. here's the vibe. you run it like this:
USAGE: clang-query [options] <source0> [... <sourceN>]
and then you get OPTIONS. yes that's literally the whole thing, she's a simple girlie π
β¨ OPTIONS β¨
πΈ Generic Options
--helpβ shows you the available options. want more? there's--help-hiddenfor that, no cap π--help-listβ prints out the list of available options (--help-list-hiddengets you even more)--versionβ tells you which version of this program you're running π
π§ clang-query options
-c <command>β name the command you want to run--extra-arg=<string>β one more argument, and it gets appended to the compiler command line π«Ά--extra-arg-before=<string>β same energy but it gets prepended instead-f <file>β read the commands straight out of file π-p <string>β build path--preload=<file>β preload commands from file and then start interactive mode π₯--use-colorβ colors in the detailed AST output. if you don't set it, colors still show up if the terminal connected to standard output supports colors. it's giving β¨ automatic β¨
π the whole -p situation
-p <build-path> is how you read a compile command database. iykyk.
for example, it can be a CMake build directory with a file named compile_commands.json living in it (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 hunting for compile_commands.json through all parent paths of the first input file. see:
https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
that one's got an example of setting up Clang Tooling on a source tree, if you need it π
π the <source0> ... part
<source0> β¦ you're specifying the paths of source files here. and these paths get looked up in the compile command database, periodt.
so: if a file's path is absolute, it needs to point into CMake's source tree. if the path is relative, then your current working directory needs to be in the CMake source tree, and the file has to be in a subdirectory of the current working directory.
also "./" prefixes on relative files get automatically removed π β but the rest of a relative path must be a suffix of a path in the compile command database. not optional, bestie.
fr fr, don't skip that last bit. relative paths are picky and she will not be flexible about it π
that's the whole page, you ate it up π this was clang-query 18, dated June 2025, and it lives in the User Commands section of the manual β CLANG-QUERY(1), mwah ππ π¦β¨π
π¦ where this page comes from
- debian trixie: clang-tools-18 1:18.1.8-18+b1 Β· APACHE-2-LLVM-EXCEPTIONS
- ubuntu questing: clang-tools-18 1:18.1.8-18ubuntu2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms