Add create_sentineled_str_lit

This commit is contained in:
Daniele Cocca 2021-06-16 21:55:22 +01:00
parent 2242d3c3aa
commit 1184b1d560
2 changed files with 6 additions and 0 deletions

View File

@ -6291,6 +6291,11 @@ ZigValue *create_const_str_lit(CodeGen *g, Buf *str) {
return const_val;
}
ZigValue *create_sentineled_str_lit(CodeGen *g, Buf *str, ZigValue *sentinel) {
ZigValue *array_val = create_const_str_lit(g, str)->data.x_ptr.data.ref.pointee;
return create_const_slice(g, array_val, 0, buf_len(str), true, sentinel);
}
void init_const_bigint(ZigValue *const_val, ZigType *type, const BigInt *bigint) {
const_val->special = ConstValSpecialStatic;
const_val->type = type;

View File

@ -144,6 +144,7 @@ ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent);
void init_const_str_lit(CodeGen *g, ZigValue *const_val, Buf *str, bool move_str);
ZigValue *create_const_str_lit(CodeGen *g, Buf *str);
ZigValue *create_sentineled_str_lit(CodeGen *g, Buf *str, ZigValue *sentinel);
void init_const_bigint(ZigValue *const_val, ZigType *type, const BigInt *bigint);
ZigValue *create_const_bigint(CodeGen *g, ZigType *type, const BigInt *bigint);