Coverage Report

Created: 2026-09-28 06:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/WasmEdge/include/common/errcode.h
Line
Count
Source
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright The WasmEdge Authors
3
4
//===-- wasmedge/common/errcode.h - Error code definition -----------------===//
5
//
6
// Part of the WasmEdge Project.
7
//
8
//===----------------------------------------------------------------------===//
9
///
10
/// \file
11
/// This file contains the `Expected` wrappers.
12
///
13
//===----------------------------------------------------------------------===//
14
#pragma once
15
16
#include "common/enum_errcode.hpp"
17
#include "common/expected.h"
18
#include "common/fmt.h"
19
#include "common/hexstr.h"
20
#include "common/spdlog.h"
21
22
#include <cassert>
23
#include <ostream>
24
25
#if defined(_MSC_VER) && !defined(__clang__)
26
#define __builtin_unreachable() __assume(0)
27
#endif
28
29
#ifdef NDEBUG
30
#define assuming(R)                                                            \
31
20.0M
  (static_cast<bool>(R) ? static_cast<void>(0) : __builtin_unreachable())
32
0
#define assumingUnreachable() __builtin_unreachable()
33
#else
34
#define assuming(expr) assert(expr)
35
#define assumingUnreachable()                                                  \
36
  (assert(false && "unreachable"), __builtin_unreachable())
37
#endif
38
39
namespace WasmEdge {
40
41
677M
static inline constexpr bool likely(bool V) noexcept {
42
677M
  return __builtin_expect(V, true);
43
677M
}
component.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
7.36M
static inline constexpr bool likely(bool V) noexcept {
42
7.36M
  return __builtin_expect(V, true);
43
7.36M
}
loader.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
101k
static inline constexpr bool likely(bool V) noexcept {
42
101k
  return __builtin_expect(V, true);
43
101k
}
component_section.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
27.5M
static inline constexpr bool likely(bool V) noexcept {
42
27.5M
  return __builtin_expect(V, true);
43
27.5M
}
component_instance.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
6.53M
static inline constexpr bool likely(bool V) noexcept {
42
6.53M
  return __builtin_expect(V, true);
43
6.53M
}
component_sort.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
62.1k
static inline constexpr bool likely(bool V) noexcept {
42
62.1k
  return __builtin_expect(V, true);
43
62.1k
}
component_alias.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
55.2k
static inline constexpr bool likely(bool V) noexcept {
42
55.2k
  return __builtin_expect(V, true);
43
55.2k
}
component_canonical.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
296k
static inline constexpr bool likely(bool V) noexcept {
42
296k
  return __builtin_expect(V, true);
43
296k
}
component_start.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
1.85M
static inline constexpr bool likely(bool V) noexcept {
42
1.85M
  return __builtin_expect(V, true);
43
1.85M
}
component_type.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
20.8M
static inline constexpr bool likely(bool V) noexcept {
42
20.8M
  return __builtin_expect(V, true);
43
20.8M
}
component_import.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
14.0k
static inline constexpr bool likely(bool V) noexcept {
42
14.0k
  return __builtin_expect(V, true);
43
14.0k
}
component_export.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
12.5k
static inline constexpr bool likely(bool V) noexcept {
42
12.5k
  return __builtin_expect(V, true);
43
12.5k
}
component_value.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
49.1k
static inline constexpr bool likely(bool V) noexcept {
42
49.1k
  return __builtin_expect(V, true);
43
49.1k
}
component_declarator.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
156k
static inline constexpr bool likely(bool V) noexcept {
42
156k
  return __builtin_expect(V, true);
43
156k
}
component_descriptor.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
57.6k
static inline constexpr bool likely(bool V) noexcept {
42
57.6k
  return __builtin_expect(V, true);
43
57.6k
}
component_valtype.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
2.45M
static inline constexpr bool likely(bool V) noexcept {
42
2.45M
  return __builtin_expect(V, true);
43
2.45M
}
module.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
109k
static inline constexpr bool likely(bool V) noexcept {
42
109k
  return __builtin_expect(V, true);
43
109k
}
section.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
11.9M
static inline constexpr bool likely(bool V) noexcept {
42
11.9M
  return __builtin_expect(V, true);
43
11.9M
}
description.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
570k
static inline constexpr bool likely(bool V) noexcept {
42
570k
  return __builtin_expect(V, true);
43
570k
}
segment.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
725k
static inline constexpr bool likely(bool V) noexcept {
42
725k
  return __builtin_expect(V, true);
43
725k
}
type.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
1.61M
static inline constexpr bool likely(bool V) noexcept {
42
1.61M
  return __builtin_expect(V, true);
43
1.61M
}
Unexecuted instantiation: expression.cpp:WasmEdge::likely(bool)
instruction.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
118M
static inline constexpr bool likely(bool V) noexcept {
42
118M
  return __builtin_expect(V, true);
43
118M
}
Unexecuted instantiation: serial_module.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: serial_section.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: serial_segment.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: serial_type.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: serial_description.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: serial_expression.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: serial_instruction.cpp:WasmEdge::likely(bool)
filemgr.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
114M
static inline constexpr bool likely(bool V) noexcept {
42
114M
  return __builtin_expect(V, true);
43
114M
}
Unexecuted instantiation: shared_library.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: aot_section.cpp:WasmEdge::likely(bool)
validator.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
338M
static inline constexpr bool likely(bool V) noexcept {
42
338M
  return __builtin_expect(V, true);
43
338M
}
component_validator.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
12.6M
static inline constexpr bool likely(bool V) noexcept {
42
12.6M
  return __builtin_expect(V, true);
43
12.6M
}
component_canon.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
59.2k
static inline constexpr bool likely(bool V) noexcept {
42
59.2k
  return __builtin_expect(V, true);
43
59.2k
}
component_name.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
1.92k
static inline constexpr bool likely(bool V) noexcept {
42
1.92k
  return __builtin_expect(V, true);
43
1.92k
}
formchecker.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
8.42M
static inline constexpr bool likely(bool V) noexcept {
42
8.42M
  return __builtin_expect(V, true);
43
8.42M
}
Unexecuted instantiation: component_types.cpp:WasmEdge::likely(bool)
component_context.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
326k
static inline constexpr bool likely(bool V) noexcept {
42
326k
  return __builtin_expect(V, true);
43
326k
}
Unexecuted instantiation: allocator.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: wasm_c.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: wasmedge.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: wasmedge_compat.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: fuzzTool.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: fuzzPO.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: uniTool.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: validateTool.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: parseTool.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: instantiateTool.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: toolConfig.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: compilerTool.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: runtimeTool.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: vm.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: plugin_modules.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: plugin.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: func.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: argument_parser.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: proxy.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: threadInstr.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: refInstr.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: engine.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: helper.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: executor.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: coredump.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: component_canon_abi.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: component_lower_thunk.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: component_module.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: controlInstr.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: tableInstr.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: memoryInstr.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: variableInstr.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: import.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: function.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: global.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: table.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: memory.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: elem.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: data.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: export.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: tag.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: environ.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: vinode.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: wasimodule.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: inode-linux.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: wasifunc.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: clock-linux.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: environ-linux.cpp:WasmEdge::likely(bool)
compiler.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
24.2k
static inline constexpr bool likely(bool V) noexcept {
42
24.2k
  return __builtin_expect(V, true);
43
24.2k
}
Unexecuted instantiation: context.cpp:WasmEdge::likely(bool)
function_compiler.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
1.53M
static inline constexpr bool likely(bool V) noexcept {
42
1.53M
  return __builtin_expect(V, true);
43
1.53M
}
Unexecuted instantiation: numericInstr.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: vectorInstr.cpp:WasmEdge::likely(bool)
codegen.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
4.09k
static inline constexpr bool likely(bool V) noexcept {
42
4.09k
  return __builtin_expect(V, true);
43
4.09k
}
Unexecuted instantiation: jit.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: lazyjit.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: llvm.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: fault.cpp:WasmEdge::likely(bool)
Unexecuted instantiation: stacktrace.cpp:WasmEdge::likely(bool)
hash.cpp:WasmEdge::likely(bool)
Line
Count
Source
41
615k
static inline constexpr bool likely(bool V) noexcept {
42
615k
  return __builtin_expect(V, true);
43
615k
}
44
282M
static inline constexpr bool unlikely(bool V) noexcept {
45
282M
  return __builtin_expect(V, false);
46
282M
}
component.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
112k
static inline constexpr bool unlikely(bool V) noexcept {
45
112k
  return __builtin_expect(V, false);
46
112k
}
Unexecuted instantiation: loader.cpp:WasmEdge::unlikely(bool)
component_section.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
4.89M
static inline constexpr bool unlikely(bool V) noexcept {
45
4.89M
  return __builtin_expect(V, false);
46
4.89M
}
Unexecuted instantiation: component_instance.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_sort.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_alias.cpp:WasmEdge::unlikely(bool)
component_canonical.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
13.3k
static inline constexpr bool unlikely(bool V) noexcept {
45
13.3k
  return __builtin_expect(V, false);
46
13.3k
}
Unexecuted instantiation: component_start.cpp:WasmEdge::unlikely(bool)
component_type.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
2.65M
static inline constexpr bool unlikely(bool V) noexcept {
45
2.65M
  return __builtin_expect(V, false);
46
2.65M
}
Unexecuted instantiation: component_import.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_export.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_value.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_declarator.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_descriptor.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_valtype.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: module.cpp:WasmEdge::unlikely(bool)
section.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
5.53M
static inline constexpr bool unlikely(bool V) noexcept {
45
5.53M
  return __builtin_expect(V, false);
46
5.53M
}
description.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
1.91k
static inline constexpr bool unlikely(bool V) noexcept {
45
1.91k
  return __builtin_expect(V, false);
46
1.91k
}
segment.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
16.4k
static inline constexpr bool unlikely(bool V) noexcept {
45
16.4k
  return __builtin_expect(V, false);
46
16.4k
}
type.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
2.50M
static inline constexpr bool unlikely(bool V) noexcept {
45
2.50M
  return __builtin_expect(V, false);
46
2.50M
}
Unexecuted instantiation: expression.cpp:WasmEdge::unlikely(bool)
instruction.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
39.2M
static inline constexpr bool unlikely(bool V) noexcept {
45
39.2M
  return __builtin_expect(V, false);
46
39.2M
}
Unexecuted instantiation: serial_module.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: serial_section.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: serial_segment.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: serial_type.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: serial_description.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: serial_expression.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: serial_instruction.cpp:WasmEdge::unlikely(bool)
filemgr.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
227M
static inline constexpr bool unlikely(bool V) noexcept {
45
227M
  return __builtin_expect(V, false);
46
227M
}
Unexecuted instantiation: shared_library.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: aot_section.cpp:WasmEdge::unlikely(bool)
validator.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
33.3k
static inline constexpr bool unlikely(bool V) noexcept {
45
33.3k
  return __builtin_expect(V, false);
46
33.3k
}
Unexecuted instantiation: component_validator.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_canon.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_name.cpp:WasmEdge::unlikely(bool)
formchecker.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
100k
static inline constexpr bool unlikely(bool V) noexcept {
45
100k
  return __builtin_expect(V, false);
46
100k
}
Unexecuted instantiation: component_types.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_context.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: allocator.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: wasm_c.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: wasmedge.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: wasmedge_compat.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: fuzzTool.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: fuzzPO.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: uniTool.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: validateTool.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: parseTool.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: instantiateTool.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: toolConfig.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: compilerTool.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: runtimeTool.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: vm.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: plugin_modules.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: plugin.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: func.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: argument_parser.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: proxy.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: threadInstr.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: refInstr.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: engine.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: helper.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: executor.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: coredump.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_canon_abi.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_lower_thunk.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: component_module.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: controlInstr.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: tableInstr.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: memoryInstr.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: variableInstr.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: import.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: function.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: global.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: table.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: memory.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: elem.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: data.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: export.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: tag.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: environ.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: vinode.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: wasimodule.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: inode-linux.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: wasifunc.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: clock-linux.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: environ-linux.cpp:WasmEdge::unlikely(bool)
compiler.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
2.31k
static inline constexpr bool unlikely(bool V) noexcept {
45
2.31k
  return __builtin_expect(V, false);
46
2.31k
}
Unexecuted instantiation: context.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: function_compiler.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: numericInstr.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: vectorInstr.cpp:WasmEdge::unlikely(bool)
codegen.cpp:WasmEdge::unlikely(bool)
Line
Count
Source
44
30.2k
static inline constexpr bool unlikely(bool V) noexcept {
45
30.2k
  return __builtin_expect(V, false);
46
30.2k
}
Unexecuted instantiation: jit.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: lazyjit.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: llvm.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: fault.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: stacktrace.cpp:WasmEdge::unlikely(bool)
Unexecuted instantiation: hash.cpp:WasmEdge::unlikely(bool)
47
48
/// Type aliasing for Expected<T, ErrCode>.
49
template <typename T> using Expect = Expected<T, ErrCode>;
50
51
/// Helper function for Unexpected<ErrCode>.
52
18.3k
constexpr auto Unexpect(const ErrCode &Val) { return Unexpected<ErrCode>(Val); }
53
35.8k
template <typename... ArgsT> constexpr auto Unexpect(ArgsT... Args) {
54
35.8k
  return Unexpected<ErrCode>(ErrCode(Args...));
55
35.8k
}
auto WasmEdge::Unexpect<WasmEdge::ErrCode::Value>(WasmEdge::ErrCode::Value)
Line
Count
Source
53
35.8k
template <typename... ArgsT> constexpr auto Unexpect(ArgsT... Args) {
54
35.8k
  return Unexpected<ErrCode>(ErrCode(Args...));
55
35.8k
}
Unexecuted instantiation: auto WasmEdge::Unexpect<WasmEdge::ErrCategory, unsigned int>(WasmEdge::ErrCategory, unsigned int)
56
132
template <typename T> constexpr auto Unexpect(const Expect<T> &Val) {
57
132
  return Unexpected<ErrCode>(Val.error());
58
132
}
auto WasmEdge::Unexpect<void>(cxx20::expected<void, WasmEdge::ErrCode> const&)
Line
Count
Source
56
132
template <typename T> constexpr auto Unexpect(const Expect<T> &Val) {
57
132
  return Unexpected<ErrCode>(Val.error());
58
132
}
Unexecuted instantiation: auto WasmEdge::Unexpect<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >(cxx20::expected<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, WasmEdge::ErrCode> const&)
59
60
} // namespace WasmEdge
61
62
template <>
63
struct fmt::formatter<WasmEdge::ErrCode> : fmt::formatter<std::string_view> {
64
  template <typename FmtCtx>
65
  auto format(const WasmEdge::ErrCode &Code,
66
19.5k
              FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) {
67
19.5k
    using namespace std::literals;
68
19.5k
    std::string Output =
69
19.5k
        fmt::format("{} failed: {}, Code: 0x{:03x}"sv, Code.getErrCodePhase(),
70
19.5k
                    WasmEdge::ErrCodeStr[Code.getEnum()], Code.getCode());
71
19.5k
    return formatter<std::string_view>::format(Output, Ctx);
72
19.5k
  }
73
};
74
75
template <>
76
struct fmt::formatter<WasmEdge::ErrCode::Value>
77
    : fmt::formatter<WasmEdge::ErrCode> {
78
  template <typename FmtCtx>
79
  auto format(const WasmEdge::ErrCode::Value &Value,
80
6.53k
              FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) {
81
6.53k
    return formatter<WasmEdge::ErrCode>::format(WasmEdge::ErrCode(Value), Ctx);
82
6.53k
  }
83
};