diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp index 5616701f8..9aea75be9 100644 --- a/src/llvm_backend.hpp +++ b/src/llvm_backend.hpp @@ -459,7 +459,7 @@ void lb_set_entity_from_other_modules_linkage_correctly(lbModule *other_module, lbValue lb_expr_untyped_const_to_typed(lbModule *m, Ast *expr, Type *t); bool lb_is_expr_untyped_const(Ast *expr); -LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment); +LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment, char const* name = ""); void lb_mem_zero_ptr(lbProcedure *p, LLVMValueRef ptr, Type *type, unsigned alignment); diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp index 9f77cef65..46b5fdb88 100644 --- a/src/llvm_backend_general.cpp +++ b/src/llvm_backend_general.cpp @@ -216,9 +216,9 @@ LLVMValueRef llvm_one(lbModule *m) { return LLVMConstInt(lb_type(m, t_i32), 1, false); } -LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment) { - LLVMValueRef val = LLVMBuildAlloca(p->builder, llvm_type, ""); - LLVMSetAlignment(val, alignment); +LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment, char const* name) { + LLVMValueRef val = LLVMBuildAlloca(p->builder, llvm_type, name); + LLVMSetAlignment(val, cast(unsigned int)alignment); LLVMPositionBuilderAtEnd(p->builder, p->curr_block->block); return val; @@ -2655,7 +2655,7 @@ lbAddr lb_add_local(lbProcedure *p, Type *type, Entity *e, bool zero_init, i32 p alignment *= 2; // NOTE(bill): Just in case } - LLVMValueRef ptr = llvm_alloca(p, llvm_type, alignment); + LLVMValueRef ptr = llvm_alloca(p, llvm_type, alignment, name); if (!zero_init && !force_no_init) { // If there is any padding of any kind, just zero init regardless of zero_init parameter