Skip to main content

Module project

Module project 

Source
Expand description

Project‑level traversal of C/C++ source trees.

§Entry points

Both functions distribute work across available CPU cores via [rayon::par_iter] when parallel is true.

§File filtering

Only files whose extension matches one of c, cpp, cc, cxx, h, hpp are considered. Symbolic links are not followed to avoid infinite loops on recursive directory structures.

§Error handling

The first file that fails to parse aborts the entire operation with an IcbError. Partial results are discarded.

§Memory usage

Each translation unit’s facts are collected independently and then returned as a flat vector. Rayon’s work‑stealing scheduler ensures that at most num_cpus TUs are resident in memory at any given time.

§Example

use std::path::Path;
let facts = icb_clang::project::parse_directory(
    Path::new("src"),
    &["-std=c++17".into()],
    true,
    None,
    false,
).unwrap();

Structs§

CompileCommandEntry 🔒
A single entry in a Clang compilation database.

Functions§

collect_cpp_files 🔒
Walk the directory tree and collect C/C++ source files.
extract_args 🔒
Extract compiler arguments from a compilation database entry.
parse_directory
Recursively discover C/C++ files under root and parse each one.
parse_project
Parse every source file listed in a compilation database.
resolve_file_path 🔒
Resolve a file path relative to base_dir.