pub struct CompileCommand {
pub directory: PathBuf,
pub file: SourceFile,
pub arguments: Option<CompileArgs>,
pub command: Option<String>,
pub output: Option<PathBuf>,
}Expand description
Represents a single entry within a compile_commands.json file, or a compile_flags.txt file
Either arguments or command is required. arguments is preferred, as shell (un)escaping
is a possible source of errors.
See: https://clang.llvm.org/docs/JSONCompilationDatabase.html#format
Fields§
§directory: PathBufThe working directory of the compilation. All paths specified in the command
or file fields must be either absolute or relative to this directory.
file: SourceFileThe main translation unit source processed by this compilation step. This is used by tools as the key into the compilation database. There can be multiple command objects for the same file, for example if the same source file is compiled with different configurations.
arguments: Option<CompileArgs>The compile command argv as list of strings. This should run the compilation step for the translation unit file. arguments[0] should be the executable name, such as clang++. Arguments should not be escaped, but ready to pass to execvp().
command: Option<String>The compile command as a single shell-escaped string. Arguments may be shell quoted and escaped following platform conventions, with ‘“’ and ‘\’ being the only special characters. Shell expansion is not supported.
output: Option<PathBuf>The name of the output created by this compilation step. This field is optional. It can be used to distinguish different processing modes of the same input file.
Implementations§
Source§impl CompileCommand
impl CompileCommand
Sourcepub fn args_from_cmd(&self) -> Option<Vec<String>>
pub fn args_from_cmd(&self) -> Option<Vec<String>>
Transforms the command field, if present, into a Vec<String> of equivalent
arguments
Replaces escaped ‘“’ and ’' characters with their respective literals
Trait Implementations§
Source§impl Clone for CompileCommand
impl Clone for CompileCommand
Source§fn clone(&self) -> CompileCommand
fn clone(&self) -> CompileCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more