Skip to main content

cpp_include_closure_reaches

Function cpp_include_closure_reaches 

Source
pub fn cpp_include_closure_reaches(
    cpp: &dyn CppSource,
    token: QueryToken<'_>,
    translation_unit: &ProjectFile,
    header: &ProjectFile,
) -> bool
Expand description

Whether translation_unit’s unconditional #include closure reaches header, directly or through any chain of headers.

The include-closure question asked on its own, for crate::identity::cpp_header_body_files_are_related. The walk resolves each include the way visibility does – to a unique target or to nothing – so a duplicated basename relates nothing, and it is memoized per file pair on the analyzer.

The reference position is translation_unit itself: the question is whether that unit compiles the header, so that unit’s own dialect and preprocessor context govern the walk.