fix(ir): 修改了一下context的管理

This commit is contained in:
jing
2026-03-11 23:04:28 +08:00
parent fab6983d40
commit 0e5a75eaf3
13 changed files with 112 additions and 106 deletions

View File

@@ -7,11 +7,6 @@
namespace ir {
Context& DefaultContext() {
static Context ctx;
return ctx;
}
Context::~Context() = default;
const std::shared_ptr<Type>& Context::Void() {
@@ -39,7 +34,7 @@ ConstantInt* Context::GetConstInt(int v) {
auto it = const_ints_.find(v);
if (it != const_ints_.end()) return it->second.get();
auto inserted =
const_ints_.emplace(v, std::make_unique<ConstantInt>(v)).first;
const_ints_.emplace(v, std::make_unique<ConstantInt>(Int32(), v)).first;
return inserted->second.get();
}