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§
source§impl FunctionAnalysisManagerProxy
impl FunctionAnalysisManagerProxy
sourcepub fn get_manager(&self) -> FunctionAnalysisManager
pub fn get_manager(&self) -> FunctionAnalysisManager
Returns the inner FunctionAnalysisManager.
Auto Trait Implementations§
impl RefUnwindSafe for FunctionAnalysisManagerProxy
impl !Send for FunctionAnalysisManagerProxy
impl !Sync for FunctionAnalysisManagerProxy
impl Unpin for FunctionAnalysisManagerProxy
impl UnwindSafe for FunctionAnalysisManagerProxy
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more