CompilationCommand

data class CompilationCommand(val directory: EnvPath, val file: EnvPath, val arguments: ParsedArgs, val command: RawCommandLine? = null, val output: EnvPath? = null)

A JSON Compilation Database entry.

Either arguments or command is required. arguments is preferred, as shell (un)escaping is a possible source of errors.

Parameters

directory

the working directory of the compilation. All paths specified in the command or file fields must be either absolute or relative to this directory.

file

the 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.

command

the compile command executed. After JSON unescaping, this must be a valid command to rerun the exact compilation step for the translation unit in the environment the build system uses. Parameters use shell quoting and shell escaping of quotes, with " and \ being the only special characters. Shell expansion is not supported.

arguments

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().

output

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.

See also

Throws

if file is blank, or neither command nor arguments are specified.

Constructors

Link copied to clipboard
constructor(directory: EnvPath, file: EnvPath, arguments: ParsedArgs, output: EnvPath? = null)
constructor(directory: EnvPath, file: EnvPath, command: RawCommandLine, output: EnvPath? = null)
constructor(directory: EnvPath, file: EnvPath, arguments: ParsedArgs, command: RawCommandLine? = null, output: EnvPath? = null)

Properties

Link copied to clipboard

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().

Link copied to clipboard
val command: RawCommandLine? = null

The compile command executed. After JSON unescaping, this must be a valid command to rerun the exact compilation step for the translation unit in the environment the build system uses. Parameters use shell quoting and shell escaping of quotes, with " and \ being the only special characters. Shell expansion is not supported.

Link copied to clipboard

The working directory of the compilation. All paths specified in the command or file fields must be either absolute or relative to this directory.

Link copied to clipboard

The 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.

Link copied to clipboard
val output: EnvPath? = null

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.

Link copied to clipboard

Splits the receiver into individual arguments.