fix assertion with var debug loc not initialized

This commit is contained in:
Andrew Kelley 2020-01-27 20:56:24 -05:00
parent 9d59cdb8c1
commit c58633ef17
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 3 additions and 1 deletions

View File

@ -2286,6 +2286,7 @@ struct ZigVar {
bool is_thread_local;
bool is_comptime_memoized;
bool is_comptime_memoized_value;
bool did_the_decl_codegen;
};
struct ErrorTableEntry {

View File

@ -3505,6 +3505,7 @@ static void render_decl_var(CodeGen *g, ZigVar *var) {
static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutableGen *executable, IrInstGenDeclVar *instruction) {
instruction->var->ptr_instruction = instruction->var_ptr;
instruction->var->did_the_decl_codegen = true;
render_decl_var(g, instruction->var);
return nullptr;
}
@ -3973,7 +3974,7 @@ static void render_async_var_decls(CodeGen *g, Scope *scope) {
return;
case ScopeIdVarDecl: {
ZigVar *var = reinterpret_cast<ScopeVarDecl *>(scope)->var;
if (var->ptr_instruction != nullptr) {
if (var->did_the_decl_codegen) {
render_decl_var(g, var);
}
// fallthrough