authorgravatar for dcocca@google.comDaniele Cocca <dcocca@google.com> 2021-06-16 21:55:22+01:00
committergravatar for dcocca@google.comDaniele Cocca <dcocca@google.com> 2021-06-16 21:56:39+01:00
log1184b1d560c6a86b79bbda072478320431e09189
treed2fe7ef895ddca513cfdda066ebc66b87bdf88f8
parent2242d3c3aa7d15c13737ae124f78a8261693100b

Add create_sentineled_str_lit


2 files changed, 6 insertions(+), 0 deletions(-)

src/stage1/analyze.cpp+5
......@@ -6291,6 +6291,11 @@ ZigValue *create_const_str_lit(CodeGen *g, Buf *str) {
62916291 return const_val;
62926292}
62936293
6294ZigValue *create_sentineled_str_lit(CodeGen *g, Buf *str, ZigValue *sentinel) {
6295 ZigValue *array_val = create_const_str_lit(g, str)->data.x_ptr.data.ref.pointee;
6296 return create_const_slice(g, array_val, 0, buf_len(str), true, sentinel);
6297}
6298
62946299void init_const_bigint(ZigValue *const_val, ZigType *type, const BigInt *bigint) {
62956300 const_val->special = ConstValSpecialStatic;
62966301 const_val->type = type;
src/stage1/analyze.hpp+1
......@@ -144,6 +144,7 @@ ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent);
144144
145145void init_const_str_lit(CodeGen *g, ZigValue *const_val, Buf *str, bool move_str);
146146ZigValue *create_const_str_lit(CodeGen *g, Buf *str);
147ZigValue *create_sentineled_str_lit(CodeGen *g, Buf *str, ZigValue *sentinel);
147148
148149void init_const_bigint(ZigValue *const_val, ZigType *type, const BigInt *bigint);
149150ZigValue *create_const_bigint(CodeGen *g, ZigType *type, const BigInt *bigint);