@@ -137,12 +137,12 @@ class RootResolver : public WAVM::Runtime::Resolver {
137
137
public:
138
138
RootResolver (WAVM::Runtime::Compartment * /* compartment*/ , WasmVm *vm) : vm_(vm) {}
139
139
140
- virtual ~RootResolver () { module_name_to_instance_map_.clear (); }
140
+ ~RootResolver () override { module_name_to_instance_map_.clear (); }
141
141
142
142
bool resolve (const std::string &module_name, const std::string &export_name, ExternType type,
143
143
WAVM::Runtime::Object *&out_object) override {
144
- auto named_instance = module_name_to_instance_map_.get (module_name);
145
- if (named_instance) {
144
+ auto * named_instance = module_name_to_instance_map_.get (module_name);
145
+ if (named_instance != nullptr ) {
146
146
out_object = getInstanceExport (*named_instance, export_name);
147
147
if (out_object != nullptr ) {
148
148
if (!isA (out_object, type)) {
@@ -156,7 +156,7 @@ class RootResolver : public WAVM::Runtime::Resolver {
156
156
return true ;
157
157
}
158
158
}
159
- for (auto r : resolvers_) {
159
+ for (auto * r : resolvers_) {
160
160
if (r->resolve (module_name, export_name, type, out_object)) {
161
161
return true ;
162
162
}
@@ -248,7 +248,7 @@ Wavm::~Wavm() {
248
248
intrinsic_module_instances_.clear ();
249
249
intrinsic_modules_.clear ();
250
250
host_functions_.clear ();
251
- if (compartment_) {
251
+ if (compartment_ != nullptr ) {
252
252
ASSERT (tryCollectCompartment (std::move (compartment_)));
253
253
}
254
254
}
@@ -279,7 +279,7 @@ std::unique_ptr<WasmVm> Wavm::clone() {
279
279
p.first , WAVM::Runtime::remapToClonedCompartment (p.second , wavm->compartment_ ));
280
280
}
281
281
282
- auto integration_clone = integration ()->clone ();
282
+ auto * integration_clone = integration ()->clone ();
283
283
if (integration_clone == nullptr ) {
284
284
return nullptr ;
285
285
}
@@ -325,8 +325,8 @@ bool Wavm::load(std::string_view bytecode, std::string_view precompiled,
325
325
bool Wavm::link (std::string_view debug_name) {
326
326
RootResolver rootResolver (compartment_, this );
327
327
for (auto &p : intrinsic_modules_) {
328
- auto instance = Intrinsics::instantiateModule (compartment_, {&intrinsic_modules_[p.first ]},
329
- std::string (p.first ));
328
+ auto * instance = Intrinsics::instantiateModule (compartment_, {&intrinsic_modules_[p.first ]},
329
+ std::string (p.first ));
330
330
if (instance == nullptr ) {
331
331
return false ;
332
332
}
@@ -432,10 +432,11 @@ template <typename R, typename... Args>
432
432
void getFunctionWavm (WasmVm *vm, std::string_view function_name,
433
433
std::function<R(ContextBase *, Args...)> *function) {
434
434
auto *wavm = dynamic_cast <proxy_wasm::Wavm::Wavm *>(vm);
435
- auto f =
435
+ auto * f =
436
436
asFunctionNullable (getInstanceExport (wavm->module_instance_ , std::string (function_name)));
437
- if (!f)
437
+ if (!f) {
438
438
f = asFunctionNullable (getInstanceExport (wavm->module_instance_ , std::string (function_name)));
439
+ }
439
440
if (!f) {
440
441
*function = nullptr ;
441
442
return ;
@@ -463,10 +464,11 @@ template <typename... Args>
463
464
void getFunctionWavm (WasmVm *vm, std::string_view function_name,
464
465
std::function<void (ContextBase *, Args...)> *function) {
465
466
auto *wavm = dynamic_cast <proxy_wasm::Wavm::Wavm *>(vm);
466
- auto f =
467
+ auto * f =
467
468
asFunctionNullable (getInstanceExport (wavm->module_instance_ , std::string (function_name)));
468
- if (!f)
469
+ if (!f) {
469
470
f = asFunctionNullable (getInstanceExport (wavm->module_instance_ , std::string (function_name)));
471
+ }
470
472
if (!f) {
471
473
*function = nullptr ;
472
474
return ;
0 commit comments