summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binary-reader-ir.cc222
-rw-r--r--src/binary-writer-spec.cc4
-rw-r--r--src/interp/interp-wasm-c-api.cc32
-rw-r--r--src/interp/interp.cc13
-rw-r--r--src/test-intrusive-list.cc23
-rw-r--r--src/tools/spectest-interp.cc22
-rw-r--r--src/wast-lexer.cc4
-rw-r--r--src/wast-parser.cc147
8 files changed, 242 insertions, 225 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));
diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc
index 16153f48..3cb6674d 100644
--- a/src/binary-writer-spec.cc
+++ b/src/binary-writer-spec.cc
@@ -658,8 +658,8 @@ Result WriteBinarySpecScript(
Stream* log_stream) {
WriteBinarySpecStreamFactory module_stream_factory =
[&](std::string_view filename) {
- out_module_streams->emplace_back(filename,
- MakeUnique<MemoryStream>(log_stream));
+ out_module_streams->emplace_back(
+ filename, std::make_unique<MemoryStream>(log_stream));
return out_module_streams->back().stream.get();
};
diff --git a/src/interp/interp-wasm-c-api.cc b/src/interp/interp-wasm-c-api.cc
index fe5be6c5..b20971bc 100644
--- a/src/interp/interp-wasm-c-api.cc
+++ b/src/interp/interp-wasm-c-api.cc
@@ -102,12 +102,14 @@ struct wasm_externtype_t {
struct wasm_functype_t : wasm_externtype_t {
wasm_functype_t(own wasm_valtype_vec_t* params,
own wasm_valtype_vec_t* results)
- : wasm_externtype_t{MakeUnique<FuncType>(ToWabtValueTypes(params),
- ToWabtValueTypes(results))},
+ : wasm_externtype_t{std::make_unique<FuncType>(
+ ToWabtValueTypes(params),
+ ToWabtValueTypes(results))},
params(*params),
results(*results) {}
- wasm_functype_t(FuncType ft) : wasm_externtype_t{MakeUnique<FuncType>(ft)} {
+ wasm_functype_t(FuncType ft)
+ : wasm_externtype_t{std::make_unique<FuncType>(ft)} {
FromWabtValueTypes(ft.params, &params);
FromWabtValueTypes(ft.results, &results);
}
@@ -124,14 +126,14 @@ struct wasm_functype_t : wasm_externtype_t {
struct wasm_globaltype_t : wasm_externtype_t {
wasm_globaltype_t(own wasm_valtype_t* type, wasm_mutability_t mut)
- : wasm_externtype_t{MakeUnique<GlobalType>(type->I,
- ToWabtMutability(mut))},
+ : wasm_externtype_t{std::make_unique<GlobalType>(type->I,
+ ToWabtMutability(mut))},
valtype{*type} {
wasm_valtype_delete(type);
}
wasm_globaltype_t(GlobalType gt)
- : wasm_externtype_t{MakeUnique<GlobalType>(gt)}, valtype{gt.type} {}
+ : wasm_externtype_t{std::make_unique<GlobalType>(gt)}, valtype{gt.type} {}
// Stored here because API requires returning pointers.
wasm_valtype_t valtype;
@@ -139,15 +141,15 @@ struct wasm_globaltype_t : wasm_externtype_t {
struct wasm_tabletype_t : wasm_externtype_t {
wasm_tabletype_t(own wasm_valtype_t* type, const wasm_limits_t* limits)
- : wasm_externtype_t{MakeUnique<TableType>(type->I,
- ToWabtLimits(*limits))},
+ : wasm_externtype_t{std::make_unique<TableType>(type->I,
+ ToWabtLimits(*limits))},
elemtype(*type),
limits(*limits) {
wasm_valtype_delete(type);
}
wasm_tabletype_t(TableType tt)
- : wasm_externtype_t{MakeUnique<TableType>(tt)},
+ : wasm_externtype_t{std::make_unique<TableType>(tt)},
elemtype{tt.element},
limits{FromWabtLimits(tt.limits)} {}
@@ -158,11 +160,11 @@ struct wasm_tabletype_t : wasm_externtype_t {
struct wasm_memorytype_t : wasm_externtype_t {
wasm_memorytype_t(const wasm_limits_t* limits)
- : wasm_externtype_t{MakeUnique<MemoryType>(ToWabtLimits(*limits))},
+ : wasm_externtype_t{std::make_unique<MemoryType>(ToWabtLimits(*limits))},
limits{*limits} {}
wasm_memorytype_t(MemoryType mt)
- : wasm_externtype_t{MakeUnique<MemoryType>(mt)},
+ : wasm_externtype_t{std::make_unique<MemoryType>(mt)},
limits{FromWabtLimits(mt.limits)} {}
// Stored here because API requires returning pointers.
@@ -174,16 +176,16 @@ std::unique_ptr<wasm_externtype_t> wasm_externtype_t::New(
std::unique_ptr<ExternType> ptr) {
switch (ptr->kind) {
case ExternKind::Func:
- return MakeUnique<wasm_functype_t>(*cast<FuncType>(ptr.get()));
+ return std::make_unique<wasm_functype_t>(*cast<FuncType>(ptr.get()));
case ExternKind::Table:
- return MakeUnique<wasm_tabletype_t>(*cast<TableType>(ptr.get()));
+ return std::make_unique<wasm_tabletype_t>(*cast<TableType>(ptr.get()));
case ExternKind::Memory:
- return MakeUnique<wasm_memorytype_t>(*cast<MemoryType>(ptr.get()));
+ return std::make_unique<wasm_memorytype_t>(*cast<MemoryType>(ptr.get()));
case ExternKind::Global:
- return MakeUnique<wasm_globaltype_t>(*cast<GlobalType>(ptr.get()));
+ return std::make_unique<wasm_globaltype_t>(*cast<GlobalType>(ptr.get()));
case ExternKind::Tag:
break;
diff --git a/src/interp/interp.cc b/src/interp/interp.cc
index c08bf5fe..ff0883c1 100644
--- a/src/interp/interp.cc
+++ b/src/interp/interp.cc
@@ -21,7 +21,6 @@
#include <cinttypes>
#include "wabt/interp/interp-math.h"
-#include "wabt/make-unique.h"
namespace wabt {
namespace interp {
@@ -84,7 +83,7 @@ Result Match(const Limits& expected,
//// FuncType ////
std::unique_ptr<ExternType> FuncType::Clone() const {
- return MakeUnique<FuncType>(*this);
+ return std::make_unique<FuncType>(*this);
}
Result Match(const FuncType& expected,
@@ -101,7 +100,7 @@ Result Match(const FuncType& expected,
//// TableType ////
std::unique_ptr<ExternType> TableType::Clone() const {
- return MakeUnique<TableType>(*this);
+ return std::make_unique<TableType>(*this);
}
Result Match(const TableType& expected,
@@ -123,7 +122,7 @@ Result Match(const TableType& expected,
//// MemoryType ////
std::unique_ptr<ExternType> MemoryType::Clone() const {
- return MakeUnique<MemoryType>(*this);
+ return std::make_unique<MemoryType>(*this);
}
Result Match(const MemoryType& expected,
@@ -134,7 +133,7 @@ Result Match(const MemoryType& expected,
//// GlobalType ////
std::unique_ptr<ExternType> GlobalType::Clone() const {
- return MakeUnique<GlobalType>(*this);
+ return std::make_unique<GlobalType>(*this);
}
Result Match(const GlobalType& expected,
@@ -161,7 +160,7 @@ Result Match(const GlobalType& expected,
//// TagType ////
std::unique_ptr<ExternType> TagType::Clone() const {
- return MakeUnique<TagType>(*this);
+ return std::make_unique<TagType>(*this);
}
Result Match(const TagType& expected,
@@ -973,7 +972,7 @@ Thread::Thread(Store& store, Stream* trace_stream)
frames_.reserve(options.call_stack_size);
values_.reserve(options.value_stack_size);
if (trace_stream) {
- trace_source_ = MakeUnique<TraceSource>(this);
+ trace_source_ = std::make_unique<TraceSource>(this);
}
}
diff --git a/src/test-intrusive-list.cc b/src/test-intrusive-list.cc
index 9bc054f3..25059cab 100644
--- a/src/test-intrusive-list.cc
+++ b/src/test-intrusive-list.cc
@@ -19,7 +19,6 @@
#include <memory>
#include "wabt/intrusive-list.h"
-#include "wabt/make-unique.h"
using namespace wabt;
@@ -112,7 +111,7 @@ TEST_F(IntrusiveListTest, default_constructor) {
}
TEST_F(IntrusiveListTest, node_constructor) {
- TestObjectList list(MakeUnique<TestObject>(1));
+ TestObjectList list(std::make_unique<TestObject>(1));
AssertListEq(list, {1});
}
@@ -276,9 +275,9 @@ TEST_F(IntrusiveListTest, emplace_back) {
TEST_F(IntrusiveListTest, push_front_pointer) {
TestObjectList list;
- list.push_front(MakeUnique<TestObject>(1));
- list.push_front(MakeUnique<TestObject>(2));
- list.push_front(MakeUnique<TestObject>(3));
+ list.push_front(std::make_unique<TestObject>(1));
+ list.push_front(std::make_unique<TestObject>(2));
+ list.push_front(std::make_unique<TestObject>(3));
AssertListEq(list, {3, 2, 1});
}
@@ -286,9 +285,9 @@ TEST_F(IntrusiveListTest, push_front_pointer) {
TEST_F(IntrusiveListTest, push_back_pointer) {
TestObjectList list;
- list.push_back(MakeUnique<TestObject>(1));
- list.push_back(MakeUnique<TestObject>(2));
- list.push_back(MakeUnique<TestObject>(3));
+ list.push_back(std::make_unique<TestObject>(1));
+ list.push_back(std::make_unique<TestObject>(2));
+ list.push_back(std::make_unique<TestObject>(3));
AssertListEq(list, {1, 2, 3});
}
@@ -386,10 +385,10 @@ TEST_F(IntrusiveListTest, emplace) {
TEST_F(IntrusiveListTest, insert_pointer) {
TestObjectList list;
- list.insert(list.begin(), MakeUnique<TestObject>(2));
- list.insert(list.end(), MakeUnique<TestObject>(4));
- list.insert(std::next(list.begin()), MakeUnique<TestObject>(3));
- list.insert(list.begin(), MakeUnique<TestObject>(1));
+ list.insert(list.begin(), std::make_unique<TestObject>(2));
+ list.insert(list.end(), std::make_unique<TestObject>(4));
+ list.insert(std::next(list.begin()), std::make_unique<TestObject>(3));
+ list.insert(list.begin(), std::make_unique<TestObject>(1));
AssertListEq(list, {1, 2, 3, 4});
}
diff --git a/src/tools/spectest-interp.cc b/src/tools/spectest-interp.cc
index 711aebc2..09c06f0f 100644
--- a/src/tools/spectest-interp.cc
+++ b/src/tools/spectest-interp.cc
@@ -1004,7 +1004,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
EXPECT("{");
EXPECT_KEY("type");
if (Match("\"module\"")) {
- auto command = MakeUnique<ModuleCommand>();
+ auto command = std::make_unique<ModuleCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1012,7 +1012,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
CHECK_RESULT(ParseFilename(&command->filename));
*out_command = std::move(command);
} else if (Match("\"action\"")) {
- auto command = MakeUnique<ActionCommand>();
+ auto command = std::make_unique<ActionCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1021,7 +1021,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
CHECK_RESULT(ParseActionResult());
*out_command = std::move(command);
} else if (Match("\"register\"")) {
- auto command = MakeUnique<RegisterCommand>();
+ auto command = std::make_unique<RegisterCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1029,7 +1029,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
PARSE_KEY_STRING_VALUE("as", &command->as);
*out_command = std::move(command);
} else if (Match("\"assert_malformed\"")) {
- auto command = MakeUnique<AssertMalformedCommand>();
+ auto command = std::make_unique<AssertMalformedCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1040,7 +1040,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
CHECK_RESULT(ParseModuleType(&command->type));
*out_command = std::move(command);
} else if (Match("\"assert_invalid\"")) {
- auto command = MakeUnique<AssertInvalidCommand>();
+ auto command = std::make_unique<AssertInvalidCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1051,7 +1051,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
CHECK_RESULT(ParseModuleType(&command->type));
*out_command = std::move(command);
} else if (Match("\"assert_unlinkable\"")) {
- auto command = MakeUnique<AssertUnlinkableCommand>();
+ auto command = std::make_unique<AssertUnlinkableCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1062,7 +1062,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
CHECK_RESULT(ParseModuleType(&command->type));
*out_command = std::move(command);
} else if (Match("\"assert_uninstantiable\"")) {
- auto command = MakeUnique<AssertUninstantiableCommand>();
+ auto command = std::make_unique<AssertUninstantiableCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1073,7 +1073,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
CHECK_RESULT(ParseModuleType(&command->type));
*out_command = std::move(command);
} else if (Match("\"assert_return\"")) {
- auto command = MakeUnique<AssertReturnCommand>();
+ auto command = std::make_unique<AssertReturnCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1088,7 +1088,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
CHECK_RESULT(ParseExpectedValues(&command->expected));
*out_command = std::move(command);
} else if (Match("\"assert_trap\"")) {
- auto command = MakeUnique<AssertTrapCommand>();
+ auto command = std::make_unique<AssertTrapCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1099,7 +1099,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
CHECK_RESULT(ParseActionResult());
*out_command = std::move(command);
} else if (Match("\"assert_exhaustion\"")) {
- auto command = MakeUnique<AssertExhaustionCommand>();
+ auto command = std::make_unique<AssertExhaustionCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
@@ -1114,7 +1114,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) {
PrintError("invalid command: exceptions not allowed");
return wabt::Result::Error;
}
- auto command = MakeUnique<AssertExceptionCommand>();
+ auto command = std::make_unique<AssertExceptionCommand>();
EXPECT(",");
CHECK_RESULT(ParseLine(&command->line));
EXPECT(",");
diff --git a/src/wast-lexer.cc b/src/wast-lexer.cc
index dbdee9aa..e8d25d33 100644
--- a/src/wast-lexer.cc
+++ b/src/wast-lexer.cc
@@ -52,8 +52,8 @@ std::unique_ptr<WastLexer> WastLexer::CreateBufferLexer(
const void* data,
size_t size,
Errors* errors) {
- return MakeUnique<WastLexer>(MakeUnique<LexerSource>(data, size), filename,
- errors);
+ return std::make_unique<WastLexer>(std::make_unique<LexerSource>(data, size),
+ filename, errors);
}
Token WastLexer::GetToken() {
diff --git a/src/wast-parser.cc b/src/wast-parser.cc
index 51cf52d8..e9c0687e 100644
--- a/src/wast-parser.cc
+++ b/src/wast-parser.cc
@@ -20,7 +20,6 @@
#include "wabt/binary-reader.h"
#include "wabt/cast.h"
#include "wabt/expr-visitor.h"
-#include "wabt/make-unique.h"
#include "wabt/resolve-names.h"
#include "wabt/stream.h"
#include "wabt/utf8.h"
@@ -352,8 +351,8 @@ void ResolveImplicitlyDefinedFunctionType(const Location& loc,
if (!decl.has_func_type) {
Index func_type_index = module->GetFuncTypeIndex(decl.sig);
if (func_type_index == kInvalidIndex) {
- auto func_type_field = MakeUnique<TypeModuleField>(loc);
- auto func_type = MakeUnique<FuncType>();
+ auto func_type_field = std::make_unique<TypeModuleField>(loc);
+ auto func_type = std::make_unique<FuncType>();
func_type->sig = decl.sig;
func_type_field->type = std::move(func_type);
module->AppendField(std::move(func_type_field));
@@ -891,7 +890,7 @@ bool WastParser::ParseElemExprVarListOpt(ExprListVector* out_list) {
Var var;
ExprList init_expr;
while (ParseVarOpt(&var)) {
- init_expr.push_back(MakeUnique<RefFuncExpr>(var));
+ init_expr.push_back(std::make_unique<RefFuncExpr>(var));
out_list->push_back(std::move(init_expr));
}
return !out_list->empty();
@@ -1152,7 +1151,7 @@ Result WastParser::ParseNat(uint64_t* out_nat, bool is_64) {
Result WastParser::ParseModule(std::unique_ptr<Module>* out_module) {
WABT_TRACE(ParseModule);
- auto module = MakeUnique<Module>();
+ auto module = std::make_unique<Module>();
if (PeekMatchLpar(TokenType::Module)) {
// Starts with "(module". Allow text and binary modules, but no quoted
@@ -1186,14 +1185,14 @@ Result WastParser::ParseModule(std::unique_ptr<Module>* out_module) {
Result WastParser::ParseScript(std::unique_ptr<Script>* out_script) {
WABT_TRACE(ParseScript);
- auto script = MakeUnique<Script>();
+ auto script = std::make_unique<Script>();
// Don't consume the Lpar yet, even though it is required. This way the
// sub-parser functions (e.g. ParseFuncModuleField) can consume it and keep
// the parsing structure more regular.
if (IsModuleField(PeekPair())) {
// Parse an inline module (i.e. one with no surrounding (module)).
- auto command = MakeUnique<ModuleCommand>();
+ auto command = std::make_unique<ModuleCommand>();
command->module.loc = GetLocation();
CHECK_RESULT(ParseModuleFieldList(&command->module));
script->commands.emplace_back(std::move(command));
@@ -1253,7 +1252,7 @@ Result WastParser::ParseDataModuleField(Module* module) {
EXPECT(Data);
std::string name;
ParseBindVarOpt(&name);
- auto field = MakeUnique<DataSegmentModuleField>(loc, name);
+ auto field = std::make_unique<DataSegmentModuleField>(loc, name);
if (PeekMatchLpar(TokenType::Memory)) {
EXPECT(Lpar);
@@ -1296,7 +1295,7 @@ Result WastParser::ParseElemModuleField(Module* module) {
if (!options_->features.bulk_memory_enabled()) {
segment_name = "";
}
- auto field = MakeUnique<ElemSegmentModuleField>(loc, segment_name);
+ auto field = std::make_unique<ElemSegmentModuleField>(loc, segment_name);
if (options_->features.reference_types_enabled() &&
Match(TokenType::Declare)) {
field->elem_segment.kind = SegmentKind::Declared;
@@ -1360,15 +1359,15 @@ Result WastParser::ParseTagModuleField(Module* module) {
if (PeekMatchLpar(TokenType::Import)) {
CheckImportOrdering(module);
- auto import = MakeUnique<TagImport>(name);
+ auto import = std::make_unique<TagImport>(name);
CHECK_RESULT(ParseInlineImport(import.get()));
CHECK_RESULT(ParseTypeUseOpt(&import->tag.decl));
CHECK_RESULT(ParseUnboundFuncSignature(&import->tag.decl.sig));
auto field =
- MakeUnique<ImportModuleField>(std::move(import), GetLocation());
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation());
module->AppendField(std::move(field));
} else {
- auto field = MakeUnique<TagModuleField>(GetLocation(), name);
+ auto field = std::make_unique<TagModuleField>(GetLocation(), name);
CHECK_RESULT(ParseTypeUseOpt(&field->tag.decl));
CHECK_RESULT(ParseUnboundFuncSignature(&field->tag.decl.sig));
module->AppendField(std::move(field));
@@ -1382,7 +1381,7 @@ Result WastParser::ParseTagModuleField(Module* module) {
Result WastParser::ParseExportModuleField(Module* module) {
WABT_TRACE(ParseExportModuleField);
EXPECT(Lpar);
- auto field = MakeUnique<ExportModuleField>(GetLocation());
+ auto field = std::make_unique<ExportModuleField>(GetLocation());
EXPECT(Export);
CHECK_RESULT(ParseQuotedText(&field->export_.name));
CHECK_RESULT(ParseExportDesc(&field->export_));
@@ -1404,17 +1403,17 @@ Result WastParser::ParseFuncModuleField(Module* module) {
if (PeekMatchLpar(TokenType::Import)) {
CheckImportOrdering(module);
- auto import = MakeUnique<FuncImport>(name);
+ auto import = std::make_unique<FuncImport>(name);
Func& func = import->func;
CHECK_RESULT(ParseInlineImport(import.get()));
CHECK_RESULT(ParseTypeUseOpt(&func.decl));
CHECK_RESULT(ParseFuncSignature(&func.decl.sig, &func.bindings));
CHECK_RESULT(ErrorIfLpar({"type", "param", "result"}));
auto field =
- MakeUnique<ImportModuleField>(std::move(import), GetLocation());
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation());
module->AppendField(std::move(field));
} else {
- auto field = MakeUnique<FuncModuleField>(loc, name);
+ auto field = std::make_unique<FuncModuleField>(loc, name);
Func& func = field->func;
func.loc = GetLocation();
CHECK_RESULT(ParseTypeUseOpt(&func.decl));
@@ -1437,7 +1436,7 @@ Result WastParser::ParseFuncModuleField(Module* module) {
Result WastParser::ParseTypeModuleField(Module* module) {
WABT_TRACE(ParseTypeModuleField);
EXPECT(Lpar);
- auto field = MakeUnique<TypeModuleField>(GetLocation());
+ auto field = std::make_unique<TypeModuleField>(GetLocation());
EXPECT(Type);
std::string name;
@@ -1446,7 +1445,7 @@ Result WastParser::ParseTypeModuleField(Module* module) {
Location loc = GetLocation();
if (Match(TokenType::Func)) {
- auto func_type = MakeUnique<FuncType>(name);
+ auto func_type = std::make_unique<FuncType>(name);
BindingHash bindings;
CHECK_RESULT(ParseFuncSignature(&func_type->sig, &bindings));
CHECK_RESULT(ErrorIfLpar({"param", "result"}));
@@ -1456,14 +1455,14 @@ Result WastParser::ParseTypeModuleField(Module* module) {
Error(loc, "struct not allowed");
return Result::Error;
}
- auto struct_type = MakeUnique<StructType>(name);
+ auto struct_type = std::make_unique<StructType>(name);
CHECK_RESULT(ParseFieldList(&struct_type->fields));
field->type = std::move(struct_type);
} else if (Match(TokenType::Array)) {
if (!options_->features.gc_enabled()) {
Error(loc, "array type not allowed");
}
- auto array_type = MakeUnique<ArrayType>(name);
+ auto array_type = std::make_unique<ArrayType>(name);
CHECK_RESULT(ParseField(&array_type->field));
field->type = std::move(array_type);
} else {
@@ -1529,14 +1528,14 @@ Result WastParser::ParseGlobalModuleField(Module* module) {
if (PeekMatchLpar(TokenType::Import)) {
CheckImportOrdering(module);
- auto import = MakeUnique<GlobalImport>(name);
+ auto import = std::make_unique<GlobalImport>(name);
CHECK_RESULT(ParseInlineImport(import.get()));
CHECK_RESULT(ParseGlobalType(&import->global));
auto field =
- MakeUnique<ImportModuleField>(std::move(import), GetLocation());
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation());
module->AppendField(std::move(field));
} else {
- auto field = MakeUnique<GlobalModuleField>(loc, name);
+ auto field = std::make_unique<GlobalModuleField>(loc, name);
CHECK_RESULT(ParseGlobalType(&field->global));
CHECK_RESULT(ParseTerminatingInstrList(&field->global.init_expr));
module->AppendField(std::move(field));
@@ -1567,56 +1566,56 @@ Result WastParser::ParseImportModuleField(Module* module) {
case TokenType::Func: {
Consume();
ParseBindVarOpt(&name);
- auto import = MakeUnique<FuncImport>(name);
+ auto import = std::make_unique<FuncImport>(name);
CHECK_RESULT(ParseTypeUseOpt(&import->func.decl));
CHECK_RESULT(
ParseFuncSignature(&import->func.decl.sig, &import->func.bindings));
CHECK_RESULT(ErrorIfLpar({"param", "result"}));
EXPECT(Rpar);
- field = MakeUnique<ImportModuleField>(std::move(import), loc);
+ field = std::make_unique<ImportModuleField>(std::move(import), loc);
break;
}
case TokenType::Table: {
Consume();
ParseBindVarOpt(&name);
- auto import = MakeUnique<TableImport>(name);
+ auto import = std::make_unique<TableImport>(name);
CHECK_RESULT(ParseLimits(&import->table.elem_limits));
CHECK_RESULT(ParseRefType(&import->table.elem_type));
EXPECT(Rpar);
- field = MakeUnique<ImportModuleField>(std::move(import), loc);
+ field = std::make_unique<ImportModuleField>(std::move(import), loc);
break;
}
case TokenType::Memory: {
Consume();
ParseBindVarOpt(&name);
- auto import = MakeUnique<MemoryImport>(name);
+ auto import = std::make_unique<MemoryImport>(name);
CHECK_RESULT(ParseLimitsIndex(&import->memory.page_limits));
CHECK_RESULT(ParseLimits(&import->memory.page_limits));
EXPECT(Rpar);
- field = MakeUnique<ImportModuleField>(std::move(import), loc);
+ field = std::make_unique<ImportModuleField>(std::move(import), loc);
break;
}
case TokenType::Global: {
Consume();
ParseBindVarOpt(&name);
- auto import = MakeUnique<GlobalImport>(name);
+ auto import = std::make_unique<GlobalImport>(name);
CHECK_RESULT(ParseGlobalType(&import->global));
EXPECT(Rpar);
- field = MakeUnique<ImportModuleField>(std::move(import), loc);
+ field = std::make_unique<ImportModuleField>(std::move(import), loc);
break;
}
case TokenType::Tag: {
Consume();
ParseBindVarOpt(&name);
- auto import = MakeUnique<TagImport>(name);
+ auto import = std::make_unique<TagImport>(name);
CHECK_RESULT(ParseTypeUseOpt(&import->tag.decl));
CHECK_RESULT(ParseUnboundFuncSignature(&import->tag.decl.sig));
EXPECT(Rpar);
- field = MakeUnique<ImportModuleField>(std::move(import), loc);
+ field = std::make_unique<ImportModuleField>(std::move(import), loc);
break;
}
@@ -1645,21 +1644,21 @@ Result WastParser::ParseMemoryModuleField(Module* module) {
if (PeekMatchLpar(TokenType::Import)) {
CheckImportOrdering(module);
- auto import = MakeUnique<MemoryImport>(name);
+ auto import = std::make_unique<MemoryImport>(name);
CHECK_RESULT(ParseInlineImport(import.get()));
CHECK_RESULT(ParseLimitsIndex(&import->memory.page_limits));
CHECK_RESULT(ParseLimits(&import->memory.page_limits));
auto field =
- MakeUnique<ImportModuleField>(std::move(import), GetLocation());
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation());
module->AppendField(std::move(field));
} else {
- auto field = MakeUnique<MemoryModuleField>(loc, name);
+ auto field = std::make_unique<MemoryModuleField>(loc, name);
CHECK_RESULT(ParseLimitsIndex(&field->memory.page_limits));
if (MatchLpar(TokenType::Data)) {
- auto data_segment_field = MakeUnique<DataSegmentModuleField>(loc);
+ auto data_segment_field = std::make_unique<DataSegmentModuleField>(loc);
DataSegment& data_segment = data_segment_field->data_segment;
data_segment.memory_var = Var(module->memories.size(), GetLocation());
- data_segment.offset.push_back(MakeUnique<ConstExpr>(
+ data_segment.offset.push_back(std::make_unique<ConstExpr>(
field->memory.page_limits.is_64 ? Const::I64(0) : Const::I32(0)));
data_segment.offset.back().loc = loc;
ParseTextListOpt(&data_segment.data);
@@ -1697,7 +1696,7 @@ Result WastParser::ParseStartModuleField(Module* module) {
Var var;
CHECK_RESULT(ParseVar(&var));
EXPECT(Rpar);
- module->AppendField(MakeUnique<StartModuleField>(var, loc));
+ module->AppendField(std::make_unique<StartModuleField>(var, loc));
return Result::Ok;
}
@@ -1714,12 +1713,12 @@ Result WastParser::ParseTableModuleField(Module* module) {
if (PeekMatchLpar(TokenType::Import)) {
CheckImportOrdering(module);
- auto import = MakeUnique<TableImport>(name);
+ auto import = std::make_unique<TableImport>(name);
CHECK_RESULT(ParseInlineImport(import.get()));
CHECK_RESULT(ParseLimits(&import->table.elem_limits));
CHECK_RESULT(ParseRefType(&import->table.elem_type));
auto field =
- MakeUnique<ImportModuleField>(std::move(import), GetLocation());
+ std::make_unique<ImportModuleField>(std::move(import), GetLocation());
module->AppendField(std::move(field));
} else if (PeekMatch(TokenType::ValueType)) {
Type elem_type;
@@ -1728,10 +1727,10 @@ Result WastParser::ParseTableModuleField(Module* module) {
EXPECT(Lpar);
EXPECT(Elem);
- auto elem_segment_field = MakeUnique<ElemSegmentModuleField>(loc);
+ auto elem_segment_field = std::make_unique<ElemSegmentModuleField>(loc);
ElemSegment& elem_segment = elem_segment_field->elem_segment;
elem_segment.table_var = Var(module->tables.size(), GetLocation());
- elem_segment.offset.push_back(MakeUnique<ConstExpr>(Const::I32(0)));
+ elem_segment.offset.push_back(std::make_unique<ConstExpr>(Const::I32(0)));
elem_segment.offset.back().loc = loc;
elem_segment.elem_type = elem_type;
// Syntax is either an optional list of var (legacy), or a non-empty list
@@ -1746,7 +1745,7 @@ Result WastParser::ParseTableModuleField(Module* module) {
}
EXPECT(Rpar);
- auto table_field = MakeUnique<TableModuleField>(loc, name);
+ auto table_field = std::make_unique<TableModuleField>(loc, name);
table_field->table.elem_limits.initial = elem_segment.elem_exprs.size();
table_field->table.elem_limits.max = elem_segment.elem_exprs.size();
table_field->table.elem_limits.has_max = true;
@@ -1754,7 +1753,7 @@ Result WastParser::ParseTableModuleField(Module* module) {
module->AppendField(std::move(table_field));
module->AppendField(std::move(elem_segment_field));
} else {
- auto field = MakeUnique<TableModuleField>(loc, name);
+ auto field = std::make_unique<TableModuleField>(loc, name);
CHECK_RESULT(ParseLimits(&field->table.elem_limits));
CHECK_RESULT(ParseRefType(&field->table.elem_type));
module->AppendField(std::move(field));
@@ -1789,7 +1788,7 @@ Result WastParser::ParseInlineExports(ModuleFieldList* fields,
WABT_TRACE(ParseInlineExports);
while (PeekMatchLpar(TokenType::Export)) {
EXPECT(Lpar);
- auto field = MakeUnique<ExportModuleField>(GetLocation());
+ auto field = std::make_unique<ExportModuleField>(GetLocation());
field->export_.kind = kind;
EXPECT(Export);
CHECK_RESULT(ParseQuotedText(&field->export_.name));
@@ -1951,7 +1950,7 @@ Result WastParser::ParseCodeMetadataAnnotation(ExprList* exprs) {
std::string data_text;
CHECK_RESULT(ParseQuotedText(&data_text, false));
std::vector<uint8_t> data(data_text.begin(), data_text.end());
- exprs->push_back(MakeUnique<CodeMetadataExpr>(name, std::move(data)));
+ exprs->push_back(std::make_unique<CodeMetadataExpr>(name, std::move(data)));
TokenType rpar = Peek();
WABT_USE(rpar);
assert(rpar == TokenType::Rpar);
@@ -2142,7 +2141,7 @@ Result WastParser::ParsePlainInstr(std::unique_ptr<Expr>* out_expr) {
case TokenType::BrTable: {
Consume();
- auto expr = MakeUnique<BrTableExpr>(loc);
+ auto expr = std::make_unique<BrTableExpr>(loc);
CHECK_RESULT(ParseVarList(&expr->targets));
expr->default_target = expr->targets.back();
expr->targets.pop_back();
@@ -2162,7 +2161,7 @@ Result WastParser::ParsePlainInstr(std::unique_ptr<Expr>* out_expr) {
case TokenType::CallIndirect: {
Consume();
- auto expr = MakeUnique<CallIndirectExpr>(loc);
+ auto expr = std::make_unique<CallIndirectExpr>(loc);
ParseVarOpt(&expr->table, Var(0, loc));
CHECK_RESULT(ParseTypeUseOpt(&expr->decl));
CHECK_RESULT(ParseUnboundFuncSignature(&expr->decl.sig));
@@ -2183,7 +2182,7 @@ Result WastParser::ParsePlainInstr(std::unique_ptr<Expr>* out_expr) {
case TokenType::ReturnCallIndirect: {
ErrorUnlessOpcodeEnabled(Consume());
- auto expr = MakeUnique<ReturnCallIndirectExpr>(loc);
+ auto expr = std::make_unique<ReturnCallIndirectExpr>(loc);
ParseVarOpt(&expr->table, Var(0, loc));
CHECK_RESULT(ParseTypeUseOpt(&expr->decl));
CHECK_RESULT(ParseUnboundFuncSignature(&expr->decl.sig));
@@ -2831,7 +2830,7 @@ Result WastParser::ParseBlockInstr(std::unique_ptr<Expr>* out_expr) {
switch (Peek()) {
case TokenType::Block: {
Consume();
- auto expr = MakeUnique<BlockExpr>(loc);
+ auto expr = std::make_unique<BlockExpr>(loc);
CHECK_RESULT(ParseLabelOpt(&expr->block.label));
CHECK_RESULT(ParseBlock(&expr->block));
EXPECT(End);
@@ -2842,7 +2841,7 @@ Result WastParser::ParseBlockInstr(std::unique_ptr<Expr>* out_expr) {
case TokenType::Loop: {
Consume();
- auto expr = MakeUnique<LoopExpr>(loc);
+ auto expr = std::make_unique<LoopExpr>(loc);
CHECK_RESULT(ParseLabelOpt(&expr->block.label));
CHECK_RESULT(ParseBlock(&expr->block));
EXPECT(End);
@@ -2853,7 +2852,7 @@ Result WastParser::ParseBlockInstr(std::unique_ptr<Expr>* out_expr) {
case TokenType::If: {
Consume();
- auto expr = MakeUnique<IfExpr>(loc);
+ auto expr = std::make_unique<IfExpr>(loc);
CHECK_RESULT(ParseLabelOpt(&expr->true_.label));
CHECK_RESULT(ParseBlock(&expr->true_));
if (Match(TokenType::Else)) {
@@ -2869,7 +2868,7 @@ Result WastParser::ParseBlockInstr(std::unique_ptr<Expr>* out_expr) {
case TokenType::Try: {
ErrorUnlessOpcodeEnabled(Consume());
- auto expr = MakeUnique<TryExpr>(loc);
+ auto expr = std::make_unique<TryExpr>(loc);
CatchVector catches;
CHECK_RESULT(ParseLabelOpt(&expr->block.label));
CHECK_RESULT(ParseBlock(&expr->block));
@@ -2980,7 +2979,7 @@ Result WastParser::ParseExpr(ExprList* exprs) {
case TokenType::Block: {
Consume();
Consume();
- auto expr = MakeUnique<BlockExpr>(loc);
+ auto expr = std::make_unique<BlockExpr>(loc);
CHECK_RESULT(ParseLabelOpt(&expr->block.label));
CHECK_RESULT(ParseBlock(&expr->block));
exprs->push_back(std::move(expr));
@@ -2990,7 +2989,7 @@ Result WastParser::ParseExpr(ExprList* exprs) {
case TokenType::Loop: {
Consume();
Consume();
- auto expr = MakeUnique<LoopExpr>(loc);
+ auto expr = std::make_unique<LoopExpr>(loc);
CHECK_RESULT(ParseLabelOpt(&expr->block.label));
CHECK_RESULT(ParseBlock(&expr->block));
exprs->push_back(std::move(expr));
@@ -3000,7 +2999,7 @@ Result WastParser::ParseExpr(ExprList* exprs) {
case TokenType::If: {
Consume();
Consume();
- auto expr = MakeUnique<IfExpr>(loc);
+ auto expr = std::make_unique<IfExpr>(loc);
CHECK_RESULT(ParseLabelOpt(&expr->true_.label));
CHECK_RESULT(ParseBlockDeclaration(&expr->true_.decl));
@@ -3043,7 +3042,7 @@ Result WastParser::ParseExpr(ExprList* exprs) {
Consume();
ErrorUnlessOpcodeEnabled(Consume());
- auto expr = MakeUnique<TryExpr>(loc);
+ auto expr = std::make_unique<TryExpr>(loc);
CHECK_RESULT(ParseLabelOpt(&expr->block.label));
CHECK_RESULT(ParseBlockDeclaration(&expr->block.decl));
EXPECT(Lpar);
@@ -3252,7 +3251,7 @@ Result WastParser::ParseAssertReturnCommand(CommandPtr* out_command) {
WABT_TRACE(ParseAssertReturnCommand);
EXPECT(Lpar);
EXPECT(AssertReturn);
- auto command = MakeUnique<AssertReturnCommand>();
+ auto command = std::make_unique<AssertReturnCommand>();
CHECK_RESULT(ParseAction(&command->action));
CHECK_RESULT(ParseExpectedValues(&command->expected));
EXPECT(Rpar);
@@ -3265,12 +3264,12 @@ Result WastParser::ParseAssertTrapCommand(CommandPtr* out_command) {
EXPECT(Lpar);
EXPECT(AssertTrap);
if (PeekMatchLpar(TokenType::Module)) {
- auto command = MakeUnique<AssertUninstantiableCommand>();
+ auto command = std::make_unique<AssertUninstantiableCommand>();
CHECK_RESULT(ParseScriptModule(&command->module));
CHECK_RESULT(ParseQuotedText(&command->text));
*out_command = std::move(command);
} else {
- auto command = MakeUnique<AssertTrapCommand>();
+ auto command = std::make_unique<AssertTrapCommand>();
CHECK_RESULT(ParseAction(&command->action));
CHECK_RESULT(ParseQuotedText(&command->text));
*out_command = std::move(command);
@@ -3287,7 +3286,7 @@ Result WastParser::ParseAssertUnlinkableCommand(CommandPtr* out_command) {
Result WastParser::ParseActionCommand(CommandPtr* out_command) {
WABT_TRACE(ParseActionCommand);
- auto command = MakeUnique<ActionCommand>();
+ auto command = std::make_unique<ActionCommand>();
CHECK_RESULT(ParseAction(&command->action));
*out_command = std::move(command);
return Result::Ok;
@@ -3302,7 +3301,7 @@ Result WastParser::ParseModuleCommand(Script* script, CommandPtr* out_command) {
switch (script_module->type()) {
case ScriptModuleType::Text: {
- auto command = MakeUnique<ModuleCommand>();
+ auto command = std::make_unique<ModuleCommand>();
module = &command->module;
*module = std::move(cast<TextScriptModule>(script_module.get())->module);
*out_command = std::move(command);
@@ -3310,7 +3309,7 @@ Result WastParser::ParseModuleCommand(Script* script, CommandPtr* out_command) {
}
case ScriptModuleType::Binary: {
- auto command = MakeUnique<ScriptModuleCommand>();
+ auto command = std::make_unique<ScriptModuleCommand>();
module = &command->module;
auto* bsm = cast<BinaryScriptModule>(script_module.get());
ReadBinaryOptions options;
@@ -3415,7 +3414,7 @@ Result WastParser::ParseAction(ActionPtr* out_action) {
switch (Peek()) {
case TokenType::Invoke: {
Consume();
- auto action = MakeUnique<InvokeAction>(loc);
+ auto action = std::make_unique<InvokeAction>(loc);
ParseVarOpt(&action->module_var, Var(last_module_index_, loc));
CHECK_RESULT(ParseQuotedText(&action->name));
CHECK_RESULT(ParseConstList(&action->args, ConstType::Normal));
@@ -3425,7 +3424,7 @@ Result WastParser::ParseAction(ActionPtr* out_action) {
case TokenType::Get: {
Consume();
- auto action = MakeUnique<GetAction>(loc);
+ auto action = std::make_unique<GetAction>(loc);
ParseVarOpt(&action->module_var, Var(last_module_index_, loc));
CHECK_RESULT(ParseQuotedText(&action->name));
*out_action = std::move(action);
@@ -3443,11 +3442,11 @@ Result WastParser::ParseExpectedValues(ExpectationPtr* expectation) {
WABT_TRACE(ParseExpectedValues);
Location loc = GetLocation();
if (PeekMatchLpar(TokenType::Either)) {
- auto either = MakeUnique<EitherExpectation>(loc);
+ auto either = std::make_unique<EitherExpectation>(loc);
CHECK_RESULT(ParseEither(&either->expected));
*expectation = std::move(either);
} else {
- auto values = MakeUnique<ValueExpectation>(loc);
+ auto values = std::make_unique<ValueExpectation>(loc);
CHECK_RESULT(ParseConstList(&values->expected, ConstType::Expectation));
*expectation = std::move(values);
}
@@ -3479,7 +3478,7 @@ Result WastParser::ParseScriptModule(
// ParseTextListOpt.
CHECK_RESULT(ParseTextList(&data));
- auto bsm = MakeUnique<BinaryScriptModule>();
+ auto bsm = std::make_unique<BinaryScriptModule>();
bsm->name = name;
bsm->loc = loc;
bsm->data = std::move(data);
@@ -3494,7 +3493,7 @@ Result WastParser::ParseScriptModule(
// ParseTextListOpt.
CHECK_RESULT(ParseTextList(&data));
- auto qsm = MakeUnique<QuotedScriptModule>();
+ auto qsm = std::make_unique<QuotedScriptModule>();
qsm->name = name;
qsm->loc = loc;
qsm->data = std::move(data);
@@ -3503,7 +3502,7 @@ Result WastParser::ParseScriptModule(
}
default: {
- auto tsm = MakeUnique<TextScriptModule>();
+ auto tsm = std::make_unique<TextScriptModule>();
tsm->module.name = name;
tsm->module.loc = loc;
if (IsModuleField(PeekPair())) {
@@ -3527,7 +3526,7 @@ Result WastParser::ParseAssertActionCommand(TokenType token_type,
WABT_TRACE(ParseAssertActionCommand);
EXPECT(Lpar);
CHECK_RESULT(Expect(token_type));
- auto command = MakeUnique<T>();
+ auto command = std::make_unique<T>();
CHECK_RESULT(ParseAction(&command->action));
EXPECT(Rpar);
*out_command = std::move(command);
@@ -3540,7 +3539,7 @@ Result WastParser::ParseAssertActionTextCommand(TokenType token_type,
WABT_TRACE(ParseAssertActionTextCommand);
EXPECT(Lpar);
CHECK_RESULT(Expect(token_type));
- auto command = MakeUnique<T>();
+ auto command = std::make_unique<T>();
CHECK_RESULT(ParseAction(&command->action));
CHECK_RESULT(ParseQuotedText(&command->text));
EXPECT(Rpar);
@@ -3554,7 +3553,7 @@ Result WastParser::ParseAssertScriptModuleCommand(TokenType token_type,
WABT_TRACE(ParseAssertScriptModuleCommand);
EXPECT(Lpar);
CHECK_RESULT(Expect(token_type));
- auto command = MakeUnique<T>();
+ auto command = std::make_unique<T>();
CHECK_RESULT(ParseScriptModule(&command->module));
CHECK_RESULT(ParseQuotedText(&command->text));
EXPECT(Rpar);