pub fn fix_includes<S: BuildHasher>(
files: &mut HashMap<PathBuf, PreprocFile, S>,
all_files: &HashMap<String, Vec<PathBuf>, S>,
) -> Vec<PreprocDiagnostic>Expand description
Constructs a dependency graph of the include directives
in a C/C++ file.
The dependency graph is built using both preprocessor data and not
extracted from the considered C/C++ files.
Best-effort include resolution emits non-fatal
PreprocDiagnostics (self-inclusions, include cycles, non-UTF-8
paths, files referenced but never preprocessed) as the returned
Vec rather than writing to stderr, so an embedder can capture or
suppress them. The CLI prints them to stderr; callers that do not
care may discard the result.
§Panics
Panics if any of the lockstep invariants between the include graph
g, the nodes map, and the scc_map is violated at runtime —
specifically: an SCC component node missing from the graph, a graph
node weight without a nodes map entry, a DFS-visited node without
a stored weight, or an empty-path replacement node without a
scc_map entry. These data structures are built in lockstep by
this function, so all four conditions represent unrecoverable
programmer errors rather than reachable input failures.