CLANG-QUERY(1)
β¨ NAME β¨
clang-query β bestie, it's literally a manual page for clang-query 14 π¦
π DESCRIPTION π
okay so the whole vibe of this tool, first thing you gotta know:
USAGE: clang-query [options] <source0> [... <sourceN>]
and then, the OPTIONS:
πΈ OPTIONS πΈ
π Generic Options π
these ones are the universal, everyone-gets-them options, no cap:
--helpβ shows you all the available options (and if you want the secret extra ones, hit--help-hiddeninstead) π--help-listβ prints out a list of the available options (same deal:--help-list-hiddenfor the hidden crowd) π--versionβ tells you what version of this program you're running β¨
π clang-query options π
the ones that are actually about clang-query, periodt:
-c=<command>β say which command you want it to run--extra-arg=<string>β an extra argument to tack onto the end of the compiler command line--extra-arg-before=<string>β an extra argument to tack onto the front of the compiler command line-f=<file>β read your commands from a file-p=<string>β the build path--preload=<file>β preload commands from a file, then drop straight into interactive mode π«Ά--use-colorβ use colors in the detailed AST output. If this isn't set, colors get used anyway if the terminal connected to standard output supports colors π
π οΈ so about -p <build-path> π οΈ
-p <build-path> is how you read a compile command database. it's giving "here's where my build lives, go look" energy.
fr fr, for example: it can be a CMake build directory that has a file named compile_commands.json sitting in it (you get that output by using the -DCMAKE_EXPORT_COMPILE_COMMANDS=ON CMake option). And when no build path is specified at all? it goes on a little scavenger hunt for compile_commands.json through all the parent paths of the first input file. π
want an example of setting up Clang Tooling on a source tree? it's right here, bestie:
https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
π <source0> ... β the source files π
<source0> ... is where you specify the paths of your source files.
those paths get looked up in the compile command database, and 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.
- 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.
lowkey important, highkey a vibe check for your paths β get this wrong and nothing resolves, bestie π
and that's the whole page, you ate it π
this was clang-query 14, from May 2025 β go forth and query, icon πβ¨
π¦ where this page comes from
- ubuntu questing: clang-tools-14 1:14.0.6-20ubuntu3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms