diff --git a/src/compilation.rs b/src/compilation.rs index fc3c264..58f08f3 100644 --- a/src/compilation.rs +++ b/src/compilation.rs @@ -12,27 +12,30 @@ mod LLVMWrap { use self::llvm_sys::prelude::*; use self::llvm_sys::core; use std::ptr; - pub fn ContextCreate() -> LLVMContextRef { unsafe { core::LLVMContextCreate() } } - pub fn ModuleCreateWithName(name: &str) -> LLVMModuleRef { unsafe { let n = name.as_ptr() as *const _; core::LLVMModuleCreateWithName(n) } } + pub fn CreateBuilderInContext(context: LLVMContextRef) -> LLVMBuilderRef { + unsafe { + core::LLVMCreateBuilderInContext(context) + } + } } pub fn compile_ast(ast: AST) { println!("Compiling!"); let context = LLVMWrap::ContextCreate(); let module = LLVMWrap::ModuleCreateWithName("schala"); + let builder = LLVMWrap::CreateBuilderInContext(context); unsafe { - let builder = core::LLVMCreateBuilderInContext(context); let void = core::LLVMVoidTypeInContext(context); let function_type = core::LLVMFunctionType(void, ptr::null_mut(), 0, 0);