fix(frontend): 规范一下前端实现
This commit is contained in:
@@ -19,8 +19,11 @@ void IRGenImpl::GenFuncDef(SysYParser::FuncDefContext& func) {
|
||||
if (!func.block()) {
|
||||
throw std::runtime_error("[irgen] 函数体为空");
|
||||
}
|
||||
if (!func.Ident()) {
|
||||
throw std::runtime_error("[irgen] 缺少函数名");
|
||||
}
|
||||
|
||||
func_ = module_.CreateFunction("main", ir::Type::Int32());
|
||||
func_ = module_.CreateFunction(func.Ident()->getText(), ir::Type::Int32());
|
||||
builder_.SetInsertPoint(func_->entry());
|
||||
locals_.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user