Debian Codegraph @

/

debian rust-compile-commands 0.3.0-2debian librust-compile-commands-dev debian librust-compile-commands+default-dev debian librust-compile-commands-0-dev debian librust-compile-commands-0+default-dev debian librust-compile-commands-0.3-dev debian librust-compile-commands-0.3+default-dev debian librust-compile-commands-0.3.0-dev debian librust-compile-commands-0.3.0+default-dev cargo compile_commands 0.3.0 debianjsonmakefilemarkdownrustrust-c-abishelltomlyaml 18 files · 137 symbols
View dependency graph

Depends on

  • dh-cargo (dh-sequence-cargo)
  • cargo, debhelper-compat, librust-serde-1+default-dev, librust-serde-1+derive-dev, librust-serde-json-1+default-dev, libstd-rust-dev, rustc
README (full)

Use compile_commands.json and compile_flags.txt in Rust Programs

Goal

Provide a thin wrapper type around the compile_commands.json and compile_flags.txt standards as provided by the LLVM project.

Sample usage

Given the following compile_commands.json file:

[
  { "directory": "/home/user/llvm/build",
    "arguments": ["/usr/bin/clang++", "-Irelative", "-DSOMEDEF=With spaces, quotes and \\-es.", "-c", "-o", "file.o", "file.cc"],
    "file": "file.cc" },

  { "directory": "/home/user/llvm/build",
    "command": "/usr/bin/clang++ -Irelative -DSOMEDEF=\"With spaces, quotes and \\-es.\" -c -o file.o file.cc",
    "file": "file2.cc" }
]

Or the following compile_flags.txt file:

-xc++
-I
libwidget/include/

Parse it and use as a type-safe object in your Rust project:

use std::path::PathBuf;

use compile_commands::CompilationDatabase;

fn main() {
    // Create a `CompilationDatabase` object directly from a compile_commands.json file
    let comp_cmds = include_str!("compile_commands.json");
    let comp_data = serde_json::from_str::<CompilationDatabase>(&comp_cmds).unwrap();
    _ = comp_data;

    // Or create a `CompilationDatabase` object from a compile_flags.txt file
    let comp_flags = include_str!("compile_flags.txt");
    let comp_data =
        compile_commands::from_compile_flags_txt(&PathBuf::from("~/foo/build"), &comp_flags);
    _ = comp_data;
}

Usage in the Wild

asm-lsp

Used to provide inline error diagnostics and additional per-project include directories

dir .github/
dir debian/
dir src/
file .cargo_vcs_info.json
file .gitignore
file .markdown-link-check.json
file .pre-commit-config.yaml
file Cargo.toml
file Cargo.toml.orig
file LICENSE
file README.md