mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
String str = "" is now guaranteed to be null terminated. #2083
This commit is contained in:
@@ -4701,7 +4701,8 @@ static void llvm_emit_const_expr(GenContext *c, BEValue *be_value, Expr *expr)
|
||||
ArraySize len = expr->const_expr.bytes.len;
|
||||
if (len == 0 && str_type->type_kind == TYPE_SLICE)
|
||||
{
|
||||
llvm_value_set(be_value, llvm_get_zero(c, expr->type), expr->type);
|
||||
LLVMValueRef data[2] = { llvm_emit_zstring_named(c, "", ".emptystr"), llvm_get_zero(c, type_usz) };
|
||||
llvm_value_set(be_value, llvm_get_struct_named(c->chars_type, data, 2), expr->type);
|
||||
return;
|
||||
}
|
||||
ArraySize size = expr->const_expr.bytes.len;
|
||||
|
||||
Reference in New Issue
Block a user