pub struct FunctionAnalysisManagerProxy { /* private fields */ }
Expand description

Struct allowing to make queries to the pass manager about function-level analyses.

The main use-case of such interface is to give the ability for module-level passes to trigger/query function-level analyses.

Example

struct Pass;
impl LlvmModulePass for Pass {
    fn run_pass(
        &self,
        module: &mut Module,
        manager: &ModuleAnalysisManager
     ) -> PreservedAnalyses {
        let manager = manager
            .get_function_analysis_manager_proxy(&module)
            .get_manager();

        let function = module.get_first_function().unwrap();
        let result = manager.get_result::<Analysis>(&function);
        assert_eq!(result, "Some result");

        PreservedAnalyses::All
    }
}

struct Analysis;
impl LlvmFunctionAnalysis for Analysis {
    type Result = String;

    fn run_analysis(
        &self,
        _function: &FunctionValue,
        _manager: &FunctionAnalysisManager,
    ) -> Self::Result {
        "Some result".to_owned()
    }

    fn id() -> AnalysisKey {
        1 as AnalysisKey
    }
}

Implementations§

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.