cast isize to unsigned int for llvm api, add defaulted name parameter to helper.

This commit is contained in:
Henry Dooley
2021-12-25 16:46:02 -06:00
parent 516065d7c2
commit 069c05669f
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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);
+4 -4
View File
@@ -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