diff options
| author | gingerBill <bill@gingerbill.org> | 2021-10-07 13:41:14 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-10-07 13:41:14 +0100 |
| commit | af7008aa447edd71cf45d3b8e501bbd05db12a46 (patch) | |
| tree | 09acc75a4bf66b611153e0126783d40db99327f7 | |
| parent | 58e3f779f274a9619e9c2e1113fafbb4bec6a2b9 (diff) | |
Allow for array programming value constants
| -rw-r--r-- | src/llvm_backend_const.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index 0cdf28475..68050e0ce 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -483,14 +483,9 @@ lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_loc res.value = llvm_const_array(et, elems, cast(unsigned)count); return res; } - GB_PANIC("This should not have happened!\n"); - - LLVMValueRef data = LLVMConstStringInContext(ctx, - cast(char const *)value.value_string.text, - cast(unsigned)value.value_string.len, - false /*DontNullTerminate*/); - res.value = data; - return res; + // NOTE(bill, 2021-10-07): Allow for array programming value constants + Type *core_elem = core_array_type(type); + return lb_const_value(m, core_elem, value, allow_local); } else if (is_type_u8_array(type) && value.kind == ExactValue_String) { GB_ASSERT(type->Array.count == value.value_string.len); LLVMValueRef data = LLVMConstStringInContext(ctx, |