Skip to content

Commit 0ebdee2

Browse files
committed
review: fix WAVM build with clang-tidy.
Signed-off-by: Piotr Sikora <[email protected]>
1 parent bc82fdd commit 0ebdee2

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

.github/workflows/cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
--config clang-tidy \
6868
--define engine=multi \
6969
--copt=-DPROXY_WASM_VERIFY_WITH_ED25519_PUBKEY=\"$(xxd -p -c 256 test/test_data/signature_key1.pub | cut -b9-)\" \
70-
-- //... -//:wavm_lib
70+
-- //...
7171
7272
test_data:
7373
name: build test data

BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ cc_library(
196196
],
197197
hdrs = ["include/proxy-wasm/wavm.h"],
198198
copts = [
199-
'-DWAVM_API=""',
199+
"-DWAVM_API=",
200200
"-Wno-non-virtual-dtor",
201201
"-Wno-old-style-cast",
202202
],

src/wavm/wavm.cc

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ class RootResolver : public WAVM::Runtime::Resolver {
137137
public:
138138
RootResolver(WAVM::Runtime::Compartment * /*compartment*/, WasmVm *vm) : vm_(vm) {}
139139

140-
virtual ~RootResolver() { module_name_to_instance_map_.clear(); }
140+
~RootResolver() override { module_name_to_instance_map_.clear(); }
141141

142142
bool resolve(const std::string &module_name, const std::string &export_name, ExternType type,
143143
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) {
146146
out_object = getInstanceExport(*named_instance, export_name);
147147
if (out_object != nullptr) {
148148
if (!isA(out_object, type)) {
@@ -156,7 +156,7 @@ class RootResolver : public WAVM::Runtime::Resolver {
156156
return true;
157157
}
158158
}
159-
for (auto r : resolvers_) {
159+
for (auto *r : resolvers_) {
160160
if (r->resolve(module_name, export_name, type, out_object)) {
161161
return true;
162162
}
@@ -248,7 +248,7 @@ Wavm::~Wavm() {
248248
intrinsic_module_instances_.clear();
249249
intrinsic_modules_.clear();
250250
host_functions_.clear();
251-
if (compartment_) {
251+
if (compartment_ != nullptr) {
252252
ASSERT(tryCollectCompartment(std::move(compartment_)));
253253
}
254254
}
@@ -279,7 +279,7 @@ std::unique_ptr<WasmVm> Wavm::clone() {
279279
p.first, WAVM::Runtime::remapToClonedCompartment(p.second, wavm->compartment_));
280280
}
281281

282-
auto integration_clone = integration()->clone();
282+
auto *integration_clone = integration()->clone();
283283
if (integration_clone == nullptr) {
284284
return nullptr;
285285
}
@@ -325,8 +325,8 @@ bool Wavm::load(std::string_view bytecode, std::string_view precompiled,
325325
bool Wavm::link(std::string_view debug_name) {
326326
RootResolver rootResolver(compartment_, this);
327327
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));
330330
if (instance == nullptr) {
331331
return false;
332332
}
@@ -432,10 +432,11 @@ template <typename R, typename... Args>
432432
void getFunctionWavm(WasmVm *vm, std::string_view function_name,
433433
std::function<R(ContextBase *, Args...)> *function) {
434434
auto *wavm = dynamic_cast<proxy_wasm::Wavm::Wavm *>(vm);
435-
auto f =
435+
auto *f =
436436
asFunctionNullable(getInstanceExport(wavm->module_instance_, std::string(function_name)));
437-
if (!f)
437+
if (!f) {
438438
f = asFunctionNullable(getInstanceExport(wavm->module_instance_, std::string(function_name)));
439+
}
439440
if (!f) {
440441
*function = nullptr;
441442
return;
@@ -463,10 +464,11 @@ template <typename... Args>
463464
void getFunctionWavm(WasmVm *vm, std::string_view function_name,
464465
std::function<void(ContextBase *, Args...)> *function) {
465466
auto *wavm = dynamic_cast<proxy_wasm::Wavm::Wavm *>(vm);
466-
auto f =
467+
auto *f =
467468
asFunctionNullable(getInstanceExport(wavm->module_instance_, std::string(function_name)));
468-
if (!f)
469+
if (!f) {
469470
f = asFunctionNullable(getInstanceExport(wavm->module_instance_, std::string(function_name)));
471+
}
470472
if (!f) {
471473
*function = nullptr;
472474
return;

0 commit comments

Comments
 (0)