summaryrefslogtreecommitdiff
path: root/src/binary-reader-ir.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r--src/binary-reader-ir.cc222
1 files changed, 120 insertions, 102 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc
index e03453a2..6bc1c0eb 100644
--- a/src/binary-reader-ir.cc
+++ b/src/binary-reader-ir.cc
@@ -498,8 +498,8 @@ Result BinaryReaderIR::OnFuncType(Index index,
Type* param_types,
Index result_count,
Type* result_types) {
- auto field = MakeUnique<TypeModuleField>(GetLocation());
- auto func_type = MakeUnique<FuncType>();
+ auto field = std::make_unique<TypeModuleField>(GetLocation());
+ auto func_type = std::make_unique<FuncType>();
func_type->sig.param_types.assign(param_types, param_types + param_count);
func_type->sig.result_types.assign(result_types, result_types + result_count);
field->type = std::move(func_type);
@@ -510,8 +510,8 @@ Result BinaryReaderIR::OnFuncType(Index index,
Result BinaryReaderIR::OnStructType(Index index,
Index field_count,
TypeMut* fields) {
- auto field = MakeUnique<TypeModuleField>(GetLocation());
- auto struct_type = MakeUnique<StructType>();
+ auto field = std::make_unique<TypeModuleField>(GetLocation());
+ auto struct_type = std::make_unique<StructType>();
struct_type->fields.resize(field_count);
for (Index i = 0; i < field_count; ++i) {
struct_type->fields[i].type = fields[i].type;
@@ -523,8 +523,8 @@ Result BinaryReaderIR::OnStructType(Index index,
}
Result BinaryReaderIR::OnArrayType(Index index, TypeMut type_mut) {
- auto field = MakeUnique<TypeModuleField>(GetLocation());
- auto array_type = MakeUnique<ArrayType>();
+ auto field = std::make_unique<TypeModuleField>(GetLocation());
+ auto array_type = std::make_unique<ArrayType>();
array_type->field.type = type_mut.type;
array_type->field.mutable_ = type_mut.mutable_;
field->type = std::move(array_type);
@@ -544,12 +544,12 @@ Result BinaryReaderIR::OnImportFunc(Index import_index,
std::string_view field_name,
Index func_index,
Index sig_index) {
- auto import = MakeUnique<FuncImport>();
+ auto import = std::make_unique<FuncImport>();
import->module_name = module_name;
import->field_name = field_name;
SetFuncDeclaration(&import->func.decl, Var(sig_index, GetLocation()));
module_->AppendField(
- MakeUnique<ImportModuleField>(std::move(import), GetLocation()));
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation()));
return Result::Ok;
}
@@ -559,13 +559,13 @@ Result BinaryReaderIR::OnImportTable(Index import_index,
Index table_index,
Type elem_type,
const Limits* elem_limits) {
- auto import = MakeUnique<TableImport>();
+ auto import = std::make_unique<TableImport>();
import->module_name = module_name;
import->field_name = field_name;
import->table.elem_limits = *elem_limits;
import->table.elem_type = elem_type;
module_->AppendField(
- MakeUnique<ImportModuleField>(std::move(import), GetLocation()));
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation()));
return Result::Ok;
}
@@ -574,12 +574,12 @@ Result BinaryReaderIR::OnImportMemory(Index import_index,
std::string_view field_name,
Index memory_index,
const Limits* page_limits) {
- auto import = MakeUnique<MemoryImport>();
+ auto import = std::make_unique<MemoryImport>();
import->module_name = module_name;
import->field_name = field_name;
import->memory.page_limits = *page_limits;
module_->AppendField(
- MakeUnique<ImportModuleField>(std::move(import), GetLocation()));
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation()));
return Result::Ok;
}
@@ -589,13 +589,13 @@ Result BinaryReaderIR::OnImportGlobal(Index import_index,
Index global_index,
Type type,
bool mutable_) {
- auto import = MakeUnique<GlobalImport>();
+ auto import = std::make_unique<GlobalImport>();
import->module_name = module_name;
import->field_name = field_name;
import->global.type = type;
import->global.mutable_ = mutable_;
module_->AppendField(
- MakeUnique<ImportModuleField>(std::move(import), GetLocation()));
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation()));
return Result::Ok;
}
@@ -604,12 +604,12 @@ Result BinaryReaderIR::OnImportTag(Index import_index,
std::string_view field_name,
Index tag_index,
Index sig_index) {
- auto import = MakeUnique<TagImport>();
+ auto import = std::make_unique<TagImport>();
import->module_name = module_name;
import->field_name = field_name;
SetFuncDeclaration(&import->tag.decl, Var(sig_index, GetLocation()));
module_->AppendField(
- MakeUnique<ImportModuleField>(std::move(import), GetLocation()));
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation()));
return Result::Ok;
}
@@ -621,7 +621,7 @@ Result BinaryReaderIR::OnFunctionCount(Index count) {
}
Result BinaryReaderIR::OnFunction(Index index, Index sig_index) {
- auto field = MakeUnique<FuncModuleField>(GetLocation());
+ auto field = std::make_unique<FuncModuleField>(GetLocation());
Func& func = field->func;
SetFuncDeclaration(&func.decl, Var(sig_index, GetLocation()));
module_->AppendField(std::move(field));
@@ -638,7 +638,7 @@ Result BinaryReaderIR::OnTableCount(Index count) {
Result BinaryReaderIR::OnTable(Index index,
Type elem_type,
const Limits* elem_limits) {
- auto field = MakeUnique<TableModuleField>(GetLocation());
+ auto field = std::make_unique<TableModuleField>(GetLocation());
Table& table = field->table;
table.elem_limits = *elem_limits;
table.elem_type = elem_type;
@@ -654,7 +654,7 @@ Result BinaryReaderIR::OnMemoryCount(Index count) {
}
Result BinaryReaderIR::OnMemory(Index index, const Limits* page_limits) {
- auto field = MakeUnique<MemoryModuleField>(GetLocation());
+ auto field = std::make_unique<MemoryModuleField>(GetLocation());
Memory& memory = field->memory;
memory.page_limits = *page_limits;
module_->AppendField(std::move(field));
@@ -669,7 +669,7 @@ Result BinaryReaderIR::OnGlobalCount(Index count) {
}
Result BinaryReaderIR::BeginGlobal(Index index, Type type, bool mutable_) {
- auto field = MakeUnique<GlobalModuleField>(GetLocation());
+ auto field = std::make_unique<GlobalModuleField>(GetLocation());
Global& global = field->global;
global.type = type;
global.mutable_ = mutable_;
@@ -698,7 +698,7 @@ Result BinaryReaderIR::OnExport(Index index,
ExternalKind kind,
Index item_index,
std::string_view name) {
- auto field = MakeUnique<ExportModuleField>(GetLocation());
+ auto field = std::make_unique<ExportModuleField>(GetLocation());
Export& export_ = field->export_;
export_.name = name;
export_.var = Var(item_index, GetLocation());
@@ -709,7 +709,8 @@ Result BinaryReaderIR::OnExport(Index index,
Result BinaryReaderIR::OnStartFunction(Index func_index) {
Var start(func_index, GetLocation());
- module_->AppendField(MakeUnique<StartModuleField>(start, GetLocation()));
+ module_->AppendField(
+ std::make_unique<StartModuleField>(start, GetLocation()));
return Result::Ok;
}
@@ -749,7 +750,7 @@ Result BinaryReaderIR::OnAtomicLoadExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<AtomicLoadExpr>(
+ return AppendExpr(std::make_unique<AtomicLoadExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
@@ -757,7 +758,7 @@ Result BinaryReaderIR::OnAtomicStoreExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<AtomicStoreExpr>(
+ return AppendExpr(std::make_unique<AtomicStoreExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
@@ -765,7 +766,7 @@ Result BinaryReaderIR::OnAtomicRmwExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<AtomicRmwExpr>(
+ return AppendExpr(std::make_unique<AtomicRmwExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
@@ -773,7 +774,7 @@ Result BinaryReaderIR::OnAtomicRmwCmpxchgExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<AtomicRmwCmpxchgExpr>(
+ return AppendExpr(std::make_unique<AtomicRmwCmpxchgExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
@@ -781,28 +782,28 @@ Result BinaryReaderIR::OnAtomicWaitExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<AtomicWaitExpr>(
+ return AppendExpr(std::make_unique<AtomicWaitExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnAtomicFenceExpr(uint32_t consistency_model) {
- return AppendExpr(MakeUnique<AtomicFenceExpr>(consistency_model));
+ return AppendExpr(std::make_unique<AtomicFenceExpr>(consistency_model));
}
Result BinaryReaderIR::OnAtomicNotifyExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<AtomicNotifyExpr>(
+ return AppendExpr(std::make_unique<AtomicNotifyExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnBinaryExpr(Opcode opcode) {
- return AppendExpr(MakeUnique<BinaryExpr>(opcode));
+ return AppendExpr(std::make_unique<BinaryExpr>(opcode));
}
Result BinaryReaderIR::OnBlockExpr(Type sig_type) {
- auto expr = MakeUnique<BlockExpr>();
+ auto expr = std::make_unique<BlockExpr>();
SetBlockDeclaration(&expr->block.decl, sig_type);
ExprList* expr_list = &expr->block.exprs;
CHECK_RESULT(AppendExpr(std::move(expr)));
@@ -811,17 +812,17 @@ Result BinaryReaderIR::OnBlockExpr(Type sig_type) {
}
Result BinaryReaderIR::OnBrExpr(Index depth) {
- return AppendExpr(MakeUnique<BrExpr>(Var(depth, GetLocation())));
+ return AppendExpr(std::make_unique<BrExpr>(Var(depth, GetLocation())));
}
Result BinaryReaderIR::OnBrIfExpr(Index depth) {
- return AppendExpr(MakeUnique<BrIfExpr>(Var(depth, GetLocation())));
+ return AppendExpr(std::make_unique<BrIfExpr>(Var(depth, GetLocation())));
}
Result BinaryReaderIR::OnBrTableExpr(Index num_targets,
Index* target_depths,
Index default_target_depth) {
- auto expr = MakeUnique<BrTableExpr>();
+ auto expr = std::make_unique<BrTableExpr>();
expr->default_target = Var(default_target_depth, GetLocation());
expr->targets.resize(num_targets);
for (Index i = 0; i < num_targets; ++i) {
@@ -831,42 +832,43 @@ Result BinaryReaderIR::OnBrTableExpr(Index num_targets,
}
Result BinaryReaderIR::OnCallExpr(Index func_index) {
- return AppendExpr(MakeUnique<CallExpr>(Var(func_index, GetLocation())));
+ return AppendExpr(std::make_unique<CallExpr>(Var(func_index, GetLocation())));
}
Result BinaryReaderIR::OnCallIndirectExpr(Index sig_index, Index table_index) {
- auto expr = MakeUnique<CallIndirectExpr>();
+ auto expr = std::make_unique<CallIndirectExpr>();
SetFuncDeclaration(&expr->decl, Var(sig_index, GetLocation()));
expr->table = Var(table_index, GetLocation());
return AppendExpr(std::move(expr));
}
Result BinaryReaderIR::OnCallRefExpr() {
- return AppendExpr(MakeUnique<CallRefExpr>());
+ return AppendExpr(std::make_unique<CallRefExpr>());
}
Result BinaryReaderIR::OnReturnCallExpr(Index func_index) {
- return AppendExpr(MakeUnique<ReturnCallExpr>(Var(func_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<ReturnCallExpr>(Var(func_index, GetLocation())));
}
Result BinaryReaderIR::OnReturnCallIndirectExpr(Index sig_index,
Index table_index) {
- auto expr = MakeUnique<ReturnCallIndirectExpr>();
+ auto expr = std::make_unique<ReturnCallIndirectExpr>();
SetFuncDeclaration(&expr->decl, Var(sig_index, GetLocation()));
expr->table = Var(table_index, GetLocation());
return AppendExpr(std::move(expr));
}
Result BinaryReaderIR::OnCompareExpr(Opcode opcode) {
- return AppendExpr(MakeUnique<CompareExpr>(opcode));
+ return AppendExpr(std::make_unique<CompareExpr>(opcode));
}
Result BinaryReaderIR::OnConvertExpr(Opcode opcode) {
- return AppendExpr(MakeUnique<ConvertExpr>(opcode));
+ return AppendExpr(std::make_unique<ConvertExpr>(opcode));
}
Result BinaryReaderIR::OnDropExpr() {
- return AppendExpr(MakeUnique<DropExpr>());
+ return AppendExpr(std::make_unique<DropExpr>());
}
Result BinaryReaderIR::OnElseExpr() {
@@ -921,38 +923,41 @@ Result BinaryReaderIR::OnEndExpr() {
Result BinaryReaderIR::OnF32ConstExpr(uint32_t value_bits) {
return AppendExpr(
- MakeUnique<ConstExpr>(Const::F32(value_bits, GetLocation())));
+ std::make_unique<ConstExpr>(Const::F32(value_bits, GetLocation())));
}
Result BinaryReaderIR::OnF64ConstExpr(uint64_t value_bits) {
return AppendExpr(
- MakeUnique<ConstExpr>(Const::F64(value_bits, GetLocation())));
+ std::make_unique<ConstExpr>(Const::F64(value_bits, GetLocation())));
}
Result BinaryReaderIR::OnV128ConstExpr(v128 value_bits) {
return AppendExpr(
- MakeUnique<ConstExpr>(Const::V128(value_bits, GetLocation())));
+ std::make_unique<ConstExpr>(Const::V128(value_bits, GetLocation())));
}
Result BinaryReaderIR::OnGlobalGetExpr(Index global_index) {
return AppendExpr(
- MakeUnique<GlobalGetExpr>(Var(global_index, GetLocation())));
+ std::make_unique<GlobalGetExpr>(Var(global_index, GetLocation())));
}
Result BinaryReaderIR::OnLocalGetExpr(Index local_index) {
- return AppendExpr(MakeUnique<LocalGetExpr>(Var(local_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<LocalGetExpr>(Var(local_index, GetLocation())));
}
Result BinaryReaderIR::OnI32ConstExpr(uint32_t value) {
- return AppendExpr(MakeUnique<ConstExpr>(Const::I32(value, GetLocation())));
+ return AppendExpr(
+ std::make_unique<ConstExpr>(Const::I32(value, GetLocation())));
}
Result BinaryReaderIR::OnI64ConstExpr(uint64_t value) {
- return AppendExpr(MakeUnique<ConstExpr>(Const::I64(value, GetLocation())));
+ return AppendExpr(
+ std::make_unique<ConstExpr>(Const::I64(value, GetLocation())));
}
Result BinaryReaderIR::OnIfExpr(Type sig_type) {
- auto expr = MakeUnique<IfExpr>();
+ auto expr = std::make_unique<IfExpr>();
SetBlockDeclaration(&expr->true_.decl, sig_type);
ExprList* expr_list = &expr->true_.exprs;
CHECK_RESULT(AppendExpr(std::move(expr)));
@@ -964,12 +969,12 @@ Result BinaryReaderIR::OnLoadExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<LoadExpr>(opcode, Var(memidx, GetLocation()),
- 1 << alignment_log2, offset));
+ return AppendExpr(std::make_unique<LoadExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnLoopExpr(Type sig_type) {
- auto expr = MakeUnique<LoopExpr>();
+ auto expr = std::make_unique<LoopExpr>();
SetBlockDeclaration(&expr->block.decl, sig_type);
ExprList* expr_list = &expr->block.exprs;
CHECK_RESULT(AppendExpr(std::move(expr)));
@@ -978,122 +983,135 @@ Result BinaryReaderIR::OnLoopExpr(Type sig_type) {
}
Result BinaryReaderIR::OnMemoryCopyExpr(Index srcmemidx, Index destmemidx) {
- return AppendExpr(MakeUnique<MemoryCopyExpr>(Var(srcmemidx, GetLocation()),
- Var(destmemidx, GetLocation())));
+ return AppendExpr(std::make_unique<MemoryCopyExpr>(
+ Var(srcmemidx, GetLocation()), Var(destmemidx, GetLocation())));
}
Result BinaryReaderIR::OnDataDropExpr(Index segment) {
- return AppendExpr(MakeUnique<DataDropExpr>(Var(segment, GetLocation())));
+ return AppendExpr(
+ std::make_unique<DataDropExpr>(Var(segment, GetLocation())));
}
Result BinaryReaderIR::OnMemoryFillExpr(Index memidx) {
- return AppendExpr(MakeUnique<MemoryFillExpr>(Var(memidx, GetLocation())));
+ return AppendExpr(
+ std::make_unique<MemoryFillExpr>(Var(memidx, GetLocation())));
}
Result BinaryReaderIR::OnMemoryGrowExpr(Index memidx) {
- return AppendExpr(MakeUnique<MemoryGrowExpr>(Var(memidx, GetLocation())));
+ return AppendExpr(
+ std::make_unique<MemoryGrowExpr>(Var(memidx, GetLocation())));
}
Result BinaryReaderIR::OnMemoryInitExpr(Index segment, Index memidx) {
- return AppendExpr(MakeUnique<MemoryInitExpr>(Var(segment, GetLocation()),
- Var(memidx, GetLocation())));
+ return AppendExpr(std::make_unique<MemoryInitExpr>(
+ Var(segment, GetLocation()), Var(memidx, GetLocation())));
}
Result BinaryReaderIR::OnMemorySizeExpr(Index memidx) {
- return AppendExpr(MakeUnique<MemorySizeExpr>(Var(memidx, GetLocation())));
+ return AppendExpr(
+ std::make_unique<MemorySizeExpr>(Var(memidx, GetLocation())));
}
Result BinaryReaderIR::OnTableCopyExpr(Index dst_index, Index src_index) {
- return AppendExpr(MakeUnique<TableCopyExpr>(Var(dst_index, GetLocation()),
- Var(src_index, GetLocation())));
+ return AppendExpr(std::make_unique<TableCopyExpr>(
+ Var(dst_index, GetLocation()), Var(src_index, GetLocation())));
}
Result BinaryReaderIR::OnElemDropExpr(Index segment) {
- return AppendExpr(MakeUnique<ElemDropExpr>(Var(segment, GetLocation())));
+ return AppendExpr(
+ std::make_unique<ElemDropExpr>(Var(segment, GetLocation())));
}
Result BinaryReaderIR::OnTableInitExpr(Index segment, Index table_index) {
- return AppendExpr(MakeUnique<TableInitExpr>(Var(segment, GetLocation()),
- Var(table_index, GetLocation())));
+ return AppendExpr(std::make_unique<TableInitExpr>(
+ Var(segment, GetLocation()), Var(table_index, GetLocation())));
}
Result BinaryReaderIR::OnTableGetExpr(Index table_index) {
- return AppendExpr(MakeUnique<TableGetExpr>(Var(table_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<TableGetExpr>(Var(table_index, GetLocation())));
}
Result BinaryReaderIR::OnTableSetExpr(Index table_index) {
- return AppendExpr(MakeUnique<TableSetExpr>(Var(table_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<TableSetExpr>(Var(table_index, GetLocation())));
}
Result BinaryReaderIR::OnTableGrowExpr(Index table_index) {
- return AppendExpr(MakeUnique<TableGrowExpr>(Var(table_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<TableGrowExpr>(Var(table_index, GetLocation())));
}
Result BinaryReaderIR::OnTableSizeExpr(Index table_index) {
- return AppendExpr(MakeUnique<TableSizeExpr>(Var(table_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<TableSizeExpr>(Var(table_index, GetLocation())));
}
Result BinaryReaderIR::OnTableFillExpr(Index table_index) {
- return AppendExpr(MakeUnique<TableFillExpr>(Var(table_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<TableFillExpr>(Var(table_index, GetLocation())));
}
Result BinaryReaderIR::OnRefFuncExpr(Index func_index) {
- return AppendExpr(MakeUnique<RefFuncExpr>(Var(func_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<RefFuncExpr>(Var(func_index, GetLocation())));
}
Result BinaryReaderIR::OnRefNullExpr(Type type) {
- return AppendExpr(MakeUnique<RefNullExpr>(type));
+ return AppendExpr(std::make_unique<RefNullExpr>(type));
}
Result BinaryReaderIR::OnRefIsNullExpr() {
- return AppendExpr(MakeUnique<RefIsNullExpr>());
+ return AppendExpr(std::make_unique<RefIsNullExpr>());
}
Result BinaryReaderIR::OnNopExpr() {
- return AppendExpr(MakeUnique<NopExpr>());
+ return AppendExpr(std::make_unique<NopExpr>());
}
Result BinaryReaderIR::OnRethrowExpr(Index depth) {
- return AppendExpr(MakeUnique<RethrowExpr>(Var(depth, GetLocation())));
+ return AppendExpr(std::make_unique<RethrowExpr>(Var(depth, GetLocation())));
}
Result BinaryReaderIR::OnReturnExpr() {
- return AppendExpr(MakeUnique<ReturnExpr>());
+ return AppendExpr(std::make_unique<ReturnExpr>());
}
Result BinaryReaderIR::OnSelectExpr(Index result_count, Type* result_types) {
TypeVector results;
results.assign(result_types, result_types + result_count);
- return AppendExpr(MakeUnique<SelectExpr>(results));
+ return AppendExpr(std::make_unique<SelectExpr>(results));
}
Result BinaryReaderIR::OnGlobalSetExpr(Index global_index) {
return AppendExpr(
- MakeUnique<GlobalSetExpr>(Var(global_index, GetLocation())));
+ std::make_unique<GlobalSetExpr>(Var(global_index, GetLocation())));
}
Result BinaryReaderIR::OnLocalSetExpr(Index local_index) {
- return AppendExpr(MakeUnique<LocalSetExpr>(Var(local_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<LocalSetExpr>(Var(local_index, GetLocation())));
}
Result BinaryReaderIR::OnStoreExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<StoreExpr>(opcode, Var(memidx, GetLocation()),
- 1 << alignment_log2, offset));
+ return AppendExpr(std::make_unique<StoreExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnThrowExpr(Index tag_index) {
- return AppendExpr(MakeUnique<ThrowExpr>(Var(tag_index, GetLocation())));
+ return AppendExpr(std::make_unique<ThrowExpr>(Var(tag_index, GetLocation())));
}
Result BinaryReaderIR::OnLocalTeeExpr(Index local_index) {
- return AppendExpr(MakeUnique<LocalTeeExpr>(Var(local_index, GetLocation())));
+ return AppendExpr(
+ std::make_unique<LocalTeeExpr>(Var(local_index, GetLocation())));
}
Result BinaryReaderIR::OnTryExpr(Type sig_type) {
- auto expr_ptr = MakeUnique<TryExpr>();
+ auto expr_ptr = std::make_unique<TryExpr>();
// Save expr so it can be used below, after expr_ptr has been moved.
TryExpr* expr = expr_ptr.get();
ExprList* expr_list = &expr->block.exprs;
@@ -1165,15 +1183,15 @@ Result BinaryReaderIR::OnDelegateExpr(Index depth) {
}
Result BinaryReaderIR::OnUnaryExpr(Opcode opcode) {
- return AppendExpr(MakeUnique<UnaryExpr>(opcode));
+ return AppendExpr(std::make_unique<UnaryExpr>(opcode));
}
Result BinaryReaderIR::OnTernaryExpr(Opcode opcode) {
- return AppendExpr(MakeUnique<TernaryExpr>(opcode));
+ return AppendExpr(std::make_unique<TernaryExpr>(opcode));
}
Result BinaryReaderIR::OnUnreachableExpr() {
- return AppendExpr(MakeUnique<UnreachableExpr>());
+ return AppendExpr(std::make_unique<UnreachableExpr>());
}
Result BinaryReaderIR::EndFunctionBody(Index index) {
@@ -1182,7 +1200,7 @@ Result BinaryReaderIR::EndFunctionBody(Index index) {
}
Result BinaryReaderIR::OnSimdLaneOpExpr(Opcode opcode, uint64_t value) {
- return AppendExpr(MakeUnique<SimdLaneOpExpr>(opcode, value));
+ return AppendExpr(std::make_unique<SimdLaneOpExpr>(opcode, value));
}
Result BinaryReaderIR::OnSimdLoadLaneExpr(Opcode opcode,
@@ -1190,7 +1208,7 @@ Result BinaryReaderIR::OnSimdLoadLaneExpr(Opcode opcode,
Address alignment_log2,
Address offset,
uint64_t value) {
- return AppendExpr(MakeUnique<SimdLoadLaneExpr>(
+ return AppendExpr(std::make_unique<SimdLoadLaneExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset, value));
}
@@ -1199,19 +1217,19 @@ Result BinaryReaderIR::OnSimdStoreLaneExpr(Opcode opcode,
Address alignment_log2,
Address offset,
uint64_t value) {
- return AppendExpr(MakeUnique<SimdStoreLaneExpr>(
+ return AppendExpr(std::make_unique<SimdStoreLaneExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset, value));
}
Result BinaryReaderIR::OnSimdShuffleOpExpr(Opcode opcode, v128 value) {
- return AppendExpr(MakeUnique<SimdShuffleOpExpr>(opcode, value));
+ return AppendExpr(std::make_unique<SimdShuffleOpExpr>(opcode, value));
}
Result BinaryReaderIR::OnLoadSplatExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<LoadSplatExpr>(
+ return AppendExpr(std::make_unique<LoadSplatExpr>(
opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
@@ -1219,8 +1237,8 @@ Result BinaryReaderIR::OnLoadZeroExpr(Opcode opcode,
Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<LoadZeroExpr>(opcode, Var(memidx, GetLocation()),
- 1 << alignment_log2, offset));
+ return AppendExpr(std::make_unique<LoadZeroExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnElemSegmentCount(Index count) {
@@ -1233,7 +1251,7 @@ Result BinaryReaderIR::OnElemSegmentCount(Index count) {
Result BinaryReaderIR::BeginElemSegment(Index index,
Index table_index,
uint8_t flags) {
- auto field = MakeUnique<ElemSegmentModuleField>(GetLocation());
+ auto field = std::make_unique<ElemSegmentModuleField>(GetLocation());
ElemSegment& elem_segment = field->elem_segment;
elem_segment.table_var = Var(table_index, GetLocation());
if ((flags & SegDeclared) == SegDeclared) {
@@ -1288,7 +1306,7 @@ Result BinaryReaderIR::OnElemSegmentElemExpr_RefNull(Index segment_index,
ElemSegment* segment = module_->elem_segments[segment_index];
Location loc = GetLocation();
ExprList init_expr;
- init_expr.push_back(MakeUnique<RefNullExpr>(type, loc));
+ init_expr.push_back(std::make_unique<RefNullExpr>(type, loc));
segment->elem_exprs.push_back(std::move(init_expr));
return Result::Ok;
}
@@ -1299,7 +1317,7 @@ Result BinaryReaderIR::OnElemSegmentElemExpr_RefFunc(Index segment_index,
ElemSegment* segment = module_->elem_segments[segment_index];
Location loc = GetLocation();
ExprList init_expr;
- init_expr.push_back(MakeUnique<RefFuncExpr>(Var(func_index, loc), loc));
+ init_expr.push_back(std::make_unique<RefFuncExpr>(Var(func_index, loc), loc));
segment->elem_exprs.push_back(std::move(init_expr));
return Result::Ok;
}
@@ -1314,7 +1332,7 @@ Result BinaryReaderIR::OnDataSegmentCount(Index count) {
Result BinaryReaderIR::BeginDataSegment(Index index,
Index memory_index,
uint8_t flags) {
- auto field = MakeUnique<DataSegmentModuleField>(GetLocation());
+ auto field = std::make_unique<DataSegmentModuleField>(GetLocation());
DataSegment& data_segment = field->data_segment;
data_segment.memory_var = Var(memory_index, GetLocation());
if ((flags & SegPassive) == SegPassive) {
@@ -1572,8 +1590,8 @@ Result BinaryReaderIR::OnCodeMetadata(Offset offset,
Address size) {
std::vector<uint8_t> data_(static_cast<const uint8_t*>(data),
static_cast<const uint8_t*>(data) + size);
- auto meta =
- MakeUnique<CodeMetadataExpr>(current_metadata_name_, std::move(data_));
+ auto meta = std::make_unique<CodeMetadataExpr>(current_metadata_name_,
+ std::move(data_));
meta->loc.offset = offset;
code_metadata_queue_.push_metadata(std::move(meta));
return Result::Ok;
@@ -1593,7 +1611,7 @@ Result BinaryReaderIR::OnLocalName(Index func_index,
}
Result BinaryReaderIR::OnTagType(Index index, Index sig_index) {
- auto field = MakeUnique<TagModuleField>(GetLocation());
+ auto field = std::make_unique<TagModuleField>(GetLocation());
Tag& tag = field->tag;
SetFuncDeclaration(&tag.decl, Var(sig_index, GetLocation()));
module_->AppendField(std::move(field));