fix: 5项立即修复 + 2项尽快修复
立即: - lexer: token数组容量改为src_len+16 + idx越界防御 - symbol: 4个函数arena_alloc加NULL检查 - codegen: verify_err fallback用arena_strdup替代静态字符串 - codegen: cleanup_list从固定64改为arena动态扩容 - lexer: 标识符/字符串字面量65535字符上限 尽快: - to_llvm_type: TYPE_STRUCT/TYPE_UNKNOWN/TYPE_ERROR显式case - LLVMGetValueType2不存在(LLVM 22仍用旧名), 保留GlobalGetValueType
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
Scope* scope_new(void* alloc, Scope* parent) {
|
||||
Scope* s = (Scope*)arena_alloc_impl(alloc, sizeof(Scope));
|
||||
if (!s) return NULL;
|
||||
s->head = NULL;
|
||||
s->parent = parent;
|
||||
return s;
|
||||
@@ -26,6 +27,7 @@ Symbol* scope_insert(Scope* scope, void* alloc, const char* name,
|
||||
}
|
||||
}
|
||||
Symbol* sym = (Symbol*)arena_alloc_impl(alloc, sizeof(Symbol));
|
||||
if (!sym) return NULL;
|
||||
sym->name = name; sym->kind = kind; sym->type = type;
|
||||
sym->is_mut = false; sym->return_type = TYPE_VOID;
|
||||
sym->param_types = NULL; sym->param_count = 0;
|
||||
@@ -46,6 +48,7 @@ Symbol* scope_insert_function(Scope* scope, void* alloc, const char* name,
|
||||
}
|
||||
}
|
||||
Symbol* sym = (Symbol*)arena_alloc_impl(alloc, sizeof(Symbol));
|
||||
if (!sym) return NULL;
|
||||
sym->name = name; sym->kind = SYM_FUNCTION; sym->type = TYPE_VOID;
|
||||
sym->return_type = ret; sym->param_types = pt; sym->param_count = pc;
|
||||
sym->struct_field_names = NULL;
|
||||
@@ -66,6 +69,7 @@ Symbol* scope_insert_struct(Scope* scope, void* alloc, const char* name,
|
||||
}
|
||||
}
|
||||
Symbol* sym = (Symbol*)arena_alloc_impl(alloc, sizeof(Symbol));
|
||||
if (!sym) return NULL;
|
||||
sym->name = name; sym->kind = SYM_STRUCT; sym->type = TYPE_STRUCT;
|
||||
sym->is_mut = false; sym->return_type = TYPE_VOID;
|
||||
sym->param_types = NULL; sym->param_count = 0;
|
||||
|
||||
Reference in New Issue
Block a user