Expand description
Project‑level traversal of C/C++ source trees.
§Entry points
parse_project– processes every translation unit listed in acompile_commands.jsoncompilation database.parse_directory– recursively discovers C/C++ files under a root directory and parses each one with uniform compiler flags.
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§
- Compile
Command 🔒Entry - 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
rootand 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.