clang-tools 22.0.0git
|
Conditions in the CompileFlags block affect how a file is parsed. More...
#include <ConfigFragment.h>
Public Attributes | |
std::optional< Located< std::string > > | Compiler |
Override the compiler executable name to simulate. | |
std::vector< Located< std::string > > | Add |
List of flags to append to the compile command. | |
std::vector< Located< std::string > > | Remove |
List of flags to remove from the compile command. | |
std::optional< Located< std::string > > | CompilationDatabase |
Directory to search for compilation database (compile_commands.json etc). | |
std::optional< Located< std::string > > | BuiltinHeaders |
Controls whether Clangd should use its own built-in system headers (like stddef.h), or use the system headers from the query driver. |
Conditions in the CompileFlags block affect how a file is parsed.
clangd emulates how clang would interpret a file. By default, it behaves roughly like clang $FILENAME, but real projects usually require setting the include path (with the -I flag), defining preprocessor symbols, configuring warnings etc. Often, a compilation database specifies these compile commands. clangd searches for compile_commands.json in parents of the source file.
This section modifies how the compile command is constructed.
Definition at line 135 of file ConfigFragment.h.
std::vector<Located<std::string> > clang::clangd::config::Fragment::CompileFlagsBlock::Add |
List of flags to append to the compile command.
Definition at line 147 of file ConfigFragment.h.
std::optional<Located<std::string> > clang::clangd::config::Fragment::CompileFlagsBlock::BuiltinHeaders |
Controls whether Clangd should use its own built-in system headers (like stddef.h), or use the system headers from the query driver.
Use the option value 'Clangd' (default) to indicate Clangd's headers, and use 'QueryDriver' to indicate QueryDriver's headers. Clangd is the fallback if no query driver is supplied or if the query driver regex string fails to match the compiler used in the CDB.
Definition at line 180 of file ConfigFragment.h.
std::optional<Located<std::string> > clang::clangd::config::Fragment::CompileFlagsBlock::CompilationDatabase |
Directory to search for compilation database (compile_commands.json etc).
Valid values are:
Definition at line 172 of file ConfigFragment.h.
std::optional<Located<std::string> > clang::clangd::config::Fragment::CompileFlagsBlock::Compiler |
Override the compiler executable name to simulate.
The name can affect how flags are parsed (clang++ vs clang). If the executable name is in the –query-driver allowlist, then it will be invoked to extract include paths.
(That this simply replaces argv[0], and may mangle commands that use more complicated drivers like ccache).
Definition at line 144 of file ConfigFragment.h.
std::vector<Located<std::string> > clang::clangd::config::Fragment::CompileFlagsBlock::Remove |
List of flags to remove from the compile command.
In all cases, -Xclang is also removed where needed.
Example: Command: clang++ –include-directory=/usr/include -DFOO=42 foo.cc Remove: [-I, -DFOO=*] Result: clang++ foo.cc
Flags added by the same CompileFlags entry will not be removed.
Definition at line 165 of file ConfigFragment.h.