Documentation
¶
Overview ¶
Package compdb generates LLVM compilation database for Bazel targets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSource = errors.New("failed to get source")
ErrSource is error to extraction the translation unit source.
Functions ¶
func GetSource ¶
GetSource extracts the main translation unit source file from the action. It expects the source to be present in the bazel.Action.Arguments list, right after the compile flag "-c", e.g. "foo.c" source in:
bazel.Action{Arguments: [1, 2, 3, "-c", "foo.c", 4, 5]}
Types ¶
type Command ¶
type Command struct {
File string `json:"file"` // the main translation unit source
Directory string `json:"directory"` // the compilation working directory
Arguments []string `json:"arguments"` // the compile command
}
Command defines the translation unit: the main source, where to build, and the command to compile.
Ref: https://clang.llvm.org/docs/JSONCompilationDatabase.html
func GenCommands ¶
GenCommands generates compile commands for a list of targets.
func MakeCommands ¶
MakeCommands generates a list of compile commands from a set of Bazel actions. It returns an error if the actions do not include source file that is set by a pair of arguments ("-c", "file") or can't extract current working directory.