#json-parser #llvm #coverage #exports #reports #llvm-cov #source

llvm-cov-json

A library capable of parsing llvm-cov JSON exports

2 releases

0.1.1 Feb 6, 2024
0.1.0 Feb 6, 2024

#2478 in Parser implementations

30 downloads per month

AGPL-3.0-only

520KB
212 lines

llvm-cov-json-rs

This library can parse llvm-cov reports exported as JSON. Such JSON exports are typically created by using the following command:

# Dump JSON export to stdout.
llvm-cov export --format=text --instr-profile <profile-data>

For more details on LLVM's source code-based coverage, see here.

Example

use std::fs;
use llvm_cov_json::{CoverageReport};

let json_data = fs::read_to_string("coverage-report.json").unwrap()
let report: CoverageReport = serde_json::from_str(&json_data).unwrap();

/// Get the total count of branches from the summary.
let summary_branch_count = report.data[0].summary.branches.count;
println!("summary_branch_count: {}", summary_branch_count);

Dependencies

~0.7–1.4MB
~33K SLoC