diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index 658a962a74..3fb0cb55b7 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -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; diff --git a/src/stage1/analyze.hpp b/src/stage1/analyze.hpp index cbebb1036f..5c232bf4b6 100644 --- a/src/stage1/analyze.hpp +++ b/src/stage1/analyze.hpp @@ -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);