pub struct LLVM7Function {
context: llvm::LLVMContextRef,
function: llvm::LLVMValueRef,
+ parameters: Box<[LLVM7Value]>,
}
impl fmt::Debug for LLVM7Function {
))
}
}
+ fn parameters(&self) -> &[LLVM7Value] {
+ &self.parameters
+ }
}
pub struct LLVM7Context {
assert!(self.name_set.insert(name.into()));
let name = CString::new(name).unwrap();
unsafe {
+ let function = llvm::LLVMAddFunction(self.module, name.as_ptr(), ty.0);
+ let mut parameters = Vec::new();
+ parameters.resize(llvm::LLVMCountParams(function) as usize, null_mut());
+ llvm::LLVMGetParams(function, parameters.as_mut_ptr());
+ let parameters: Vec<_> = parameters.into_iter().map(LLVM7Value).collect();
LLVM7Function {
context: self.context,
function: llvm::LLVMAddFunction(self.module, name.as_ptr(), ty.0),
+ parameters: parameters.into_boxed_slice(),
}
}
}
&mut self,
name: Option<&str>,
) -> <Self::Context as Context<'a>>::BuildableBasicBlock;
+ /// get this function's parameters
+ fn parameters(&self) -> &[<Self::Context as Context<'a>>::Value];
}
/// module verification failure; returned from `Module::verify`