refactor(argparse): 将null替换为nullptr以提高C++兼容性

- 在argparse库中将所有null指针常量替换为nullptr
- 更新头文件和源文件中的指针初始化和比较操作
- 修改测试文件中的相关断言检查
- 更新AST定义文件中的注释说明
This commit is contained in:
zzy
2026-04-05 20:18:09 +08:00
parent 27d86d5685
commit 4144f7841c
76 changed files with 1430 additions and 998 deletions

View File

@@ -1,9 +1,9 @@
#include <scc_ir.h>
void scc_ir_type_init(scc_ir_type_t *in, scc_ir_type_tag_t tag) {
Assert(in != null);
Assert(in != nullptr);
in->tag = tag;
in->name = null;
in->name = nullptr;
switch (tag) {
case SCC_IR_TYPE_unknown:
case SCC_IR_TYPE_void:
@@ -40,31 +40,33 @@ void scc_ir_type_init(scc_ir_type_t *in, scc_ir_type_tag_t tag) {
}
void scc_ir_bblock_init(scc_ir_bblock_t *in, const char *label) {
Assert(in != null);
Assert(label != null);
Assert(in != nullptr);
Assert(label != nullptr);
in->label = label;
scc_vec_init(in->instrs);
}
void scc_ir_func_init(scc_ir_func_t *in, const char *name) {
Assert(in != null);
Assert(name != null);
Assert(in != nullptr);
Assert(name != nullptr);
in->name = name;
in->type = 0;
scc_vec_init(in->bblocks);
scc_vec_init(in->params);
}
void scc_ir_node_init(scc_ir_value_t *in, const char *name,
scc_ir_value_tag_t tag) {
Assert(in != null);
void scc_ir_value_init(scc_ir_value_t *in, const char *name,
scc_ir_value_tag_t tag) {
Assert(in != nullptr);
in->name = name;
in->tag = tag;
scc_vec_init(in->used_by);
in->type = 0;
switch (tag) {
case SCC_IR_VALUE_TAG_NULL:
case SCC_IR_VALUE_TAG_NULLPTR:
break;
case SCC_IR_VALUE_TAG_BUILTIN:
break;
case SCC_IR_VALUE_TAG_CONST_INT:
// TODO