pub fn scan_imports<F: FileProvider>(
tree: &CppSyntaxTree,
root_path: &Path,
files: &F,
config: &CompilerConfig,
interner: &mut PathInterner,
) -> ModuleGraphExpand description
Read a translation unit and everything it imports, building a module graph.
tree is the already-parsed root, handed over rather than re-parsed — the caller usually has it, and
parsing twice is the most expensive thing this could do. The file’s text is not needed: every question
this layer asks is a question about the tree, and the two files it does need to read (a candidate
interface unit, a header unit) it reads itself.
§The root is taken as given; everything else is a candidate
Each import is resolved, which may read a candidate file to confirm it declares what its name claims,
and a resolved module is scanned in turn. The result records both the units found and every import with
its outcome, so a consumer can distinguish “this file imports nothing” from “this file imports things
this analysis could not find” — see ImportOutcome.
§No macro environment is threaded
Deliberately, and the contrast with crate::graph::walk is the point of this module. An import does not
make the importer’s macros visible to the imported module, so there is nothing to inherit and nothing to
propagate back. A consumer that needs a file’s macros asks crate::graph about its #includes.