/src/wabt/include/wabt/cast.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2017 WebAssembly Community Group participants |
3 | | * |
4 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | | * you may not use this file except in compliance with the License. |
6 | | * You may obtain a copy of the License at |
7 | | * |
8 | | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | | * |
10 | | * Unless required by applicable law or agreed to in writing, software |
11 | | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | * See the License for the specific language governing permissions and |
14 | | * limitations under the License. |
15 | | */ |
16 | | |
17 | | #ifndef WABT_CAST_H_ |
18 | | #define WABT_CAST_H_ |
19 | | |
20 | | #include <memory> |
21 | | #include <type_traits> |
22 | | |
23 | | #include "wabt/common.h" |
24 | | |
25 | | // Modeled after LLVM's dynamic casts: |
26 | | // http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates |
27 | | // |
28 | | // Use isa<T>(foo) to check whether foo is a T*: |
29 | | // |
30 | | // if (isa<Minivan>(car)) { |
31 | | // ... |
32 | | // } |
33 | | // |
34 | | // Use cast<T>(foo) when you know that foo is a T* -- it will assert that the |
35 | | // type matches: |
36 | | // |
37 | | // switch (car.type) { |
38 | | // case CarType::Minivan: { |
39 | | // auto minivan = cast<Minivan>(car); |
40 | | // ... |
41 | | // } |
42 | | // } |
43 | | // |
44 | | // Use dyn_cast<T>(foo) as a combination if isa and cast, it will return |
45 | | // nullptr if the type doesn't match: |
46 | | // |
47 | | // if (auto minivan = dyn_cast<Minivan>(car)) { |
48 | | // ... |
49 | | // } |
50 | | // |
51 | | // |
52 | | // To use these classes in a type hierarchy, you must implement classof: |
53 | | // |
54 | | // enum CarType { Minivan, ... }; |
55 | | // struct Car { CarType type; ... }; |
56 | | // struct Minivan : Car { |
57 | | // static bool classof(const Car* car) { return car->type == Minivan; } |
58 | | // ... |
59 | | // }; |
60 | | // |
61 | | |
62 | | namespace wabt { |
63 | | |
64 | | template <typename Derived, typename Base> |
65 | 6.54M | bool isa(const Base* base) { |
66 | 6.54M | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); |
67 | 6.54M | return Derived::classof(base); |
68 | 6.54M | } bool wabt::isa<wabt::FuncModuleField, wabt::ModuleField>(wabt::ModuleField const*) Line | Count | Source | 65 | 1.70M | bool isa(const Base* base) { | 66 | 1.70M | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.70M | return Derived::classof(base); | 68 | 1.70M | } |
bool wabt::isa<wabt::TagModuleField, wabt::ModuleField>(wabt::ModuleField const*) Line | Count | Source | 65 | 717k | bool isa(const Base* base) { | 66 | 717k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 717k | return Derived::classof(base); | 68 | 717k | } |
bool wabt::isa<wabt::ImportModuleField, wabt::ModuleField>(wabt::ModuleField const*) Line | Count | Source | 65 | 717k | bool isa(const Base* base) { | 66 | 717k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 717k | return Derived::classof(base); | 68 | 717k | } |
bool wabt::isa<wabt::FuncImport, wabt::Import>(wabt::Import const*) Line | Count | Source | 65 | 142k | bool isa(const Base* base) { | 66 | 142k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 142k | return Derived::classof(base); | 68 | 142k | } |
bool wabt::isa<wabt::TagImport, wabt::Import>(wabt::Import const*) Line | Count | Source | 65 | 126k | bool isa(const Base* base) { | 66 | 126k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 126k | return Derived::classof(base); | 68 | 126k | } |
bool wabt::isa<wabt::ExportModuleField, wabt::ModuleField>(wabt::ModuleField const*) Line | Count | Source | 65 | 84.9k | bool isa(const Base* base) { | 66 | 84.9k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 84.9k | return Derived::classof(base); | 68 | 84.9k | } |
bool wabt::isa<wabt::ModuleCommand, wabt::Command>(wabt::Command const*) Line | Count | Source | 65 | 108 | bool isa(const Base* base) { | 66 | 108 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 108 | return Derived::classof(base); | 68 | 108 | } |
Unexecuted instantiation: bool wabt::isa<wabt::ScriptModuleCommand, wabt::Command>(wabt::Command const*) bool wabt::isa<wabt::TextScriptModule, wabt::ScriptModule>(wabt::ScriptModule const*) Line | Count | Source | 65 | 54 | bool isa(const Base* base) { | 66 | 54 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 54 | return Derived::classof(base); | 68 | 54 | } |
Unexecuted instantiation: bool wabt::isa<wabt::DataScriptModule<(wabt::ScriptModuleType)1>, wabt::ScriptModule>(wabt::ScriptModule const*) Unexecuted instantiation: bool wabt::isa<wabt::DataScriptModule<(wabt::ScriptModuleType)2>, wabt::ScriptModule>(wabt::ScriptModule const*) bool wabt::isa<wabt::TryExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 154k | bool isa(const Base* base) { | 66 | 154k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 154k | return Derived::classof(base); | 68 | 154k | } |
bool wabt::isa<wabt::IfExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 13.0k | bool isa(const Base* base) { | 66 | 13.0k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 13.0k | return Derived::classof(base); | 68 | 13.0k | } |
bool wabt::isa<wabt::BlockExprBase<(wabt::ExprType)8>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 22.1k | bool isa(const Base* base) { | 66 | 22.1k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 22.1k | return Derived::classof(base); | 68 | 22.1k | } |
bool wabt::isa<wabt::BlockExprBase<(wabt::ExprType)27>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 119k | bool isa(const Base* base) { | 66 | 119k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 119k | return Derived::classof(base); | 68 | 119k | } |
bool wabt::isa<wabt::TryTableExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 7.21k | bool isa(const Base* base) { | 66 | 7.21k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 7.21k | return Derived::classof(base); | 68 | 7.21k | } |
bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)0>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 564 | bool isa(const Base* base) { | 66 | 564 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 564 | return Derived::classof(base); | 68 | 564 | } |
bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)3>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.12k | bool isa(const Base* base) { | 66 | 1.12k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.12k | return Derived::classof(base); | 68 | 1.12k | } |
bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)1>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.70k | bool isa(const Base* base) { | 66 | 1.70k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.70k | return Derived::classof(base); | 68 | 1.70k | } |
bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)2>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 197 | bool isa(const Base* base) { | 66 | 197 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 197 | return Derived::classof(base); | 68 | 197 | } |
bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)6>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 514 | bool isa(const Base* base) { | 66 | 514 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 514 | return Derived::classof(base); | 68 | 514 | } |
bool wabt::isa<wabt::AtomicFenceExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 746 | bool isa(const Base* base) { | 66 | 746 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 746 | return Derived::classof(base); | 68 | 746 | } |
bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)4>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 666 | bool isa(const Base* base) { | 66 | 666 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 666 | return Derived::classof(base); | 68 | 666 | } |
bool wabt::isa<wabt::OpcodeExpr<(wabt::ExprType)7>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 737 | bool isa(const Base* base) { | 66 | 737 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 737 | return Derived::classof(base); | 68 | 737 | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)9>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 7.20k | bool isa(const Base* base) { | 66 | 7.20k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 7.20k | return Derived::classof(base); | 68 | 7.20k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)10>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 555 | bool isa(const Base* base) { | 66 | 555 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 555 | return Derived::classof(base); | 68 | 555 | } |
bool wabt::isa<wabt::BrTableExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.15k | bool isa(const Base* base) { | 66 | 1.15k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.15k | return Derived::classof(base); | 68 | 1.15k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)12>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 4.42k | bool isa(const Base* base) { | 66 | 4.42k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 4.42k | return Derived::classof(base); | 68 | 4.42k | } |
bool wabt::isa<wabt::CallIndirectExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 4.50k | bool isa(const Base* base) { | 66 | 4.50k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 4.50k | return Derived::classof(base); | 68 | 4.50k | } |
bool wabt::isa<wabt::CallRefExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 194 | bool isa(const Base* base) { | 66 | 194 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 194 | return Derived::classof(base); | 68 | 194 | } |
bool wabt::isa<wabt::CodeMetadataExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.74k | bool isa(const Base* base) { | 66 | 1.74k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.74k | return Derived::classof(base); | 68 | 1.74k | } |
bool wabt::isa<wabt::OpcodeExpr<(wabt::ExprType)16>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 644 | bool isa(const Base* base) { | 66 | 644 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 644 | return Derived::classof(base); | 68 | 644 | } |
bool wabt::isa<wabt::ConstExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 52.9k | bool isa(const Base* base) { | 66 | 52.9k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 52.9k | return Derived::classof(base); | 68 | 52.9k | } |
bool wabt::isa<wabt::OpcodeExpr<(wabt::ExprType)18>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 196 | bool isa(const Base* base) { | 66 | 196 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 196 | return Derived::classof(base); | 68 | 196 | } |
bool wabt::isa<wabt::ExprMixin<(wabt::ExprType)19>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 312 | bool isa(const Base* base) { | 66 | 312 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 312 | return Derived::classof(base); | 68 | 312 | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)20>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.77k | bool isa(const Base* base) { | 66 | 1.77k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.77k | return Derived::classof(base); | 68 | 1.77k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)21>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.49k | bool isa(const Base* base) { | 66 | 1.49k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.49k | return Derived::classof(base); | 68 | 1.49k | } |
bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)23>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.22k | bool isa(const Base* base) { | 66 | 1.22k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.22k | return Derived::classof(base); | 68 | 1.22k | } |
Unexecuted instantiation: bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)47>, wabt::Expr>(wabt::Expr const*) Unexecuted instantiation: bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)48>, wabt::Expr>(wabt::Expr const*) bool wabt::isa<wabt::VarExpr<(wabt::ExprType)24>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.88k | bool isa(const Base* base) { | 66 | 1.88k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.88k | return Derived::classof(base); | 68 | 1.88k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)25>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.89k | bool isa(const Base* base) { | 66 | 1.89k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.89k | return Derived::classof(base); | 68 | 1.89k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)26>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.92k | bool isa(const Base* base) { | 66 | 1.92k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.92k | return Derived::classof(base); | 68 | 1.92k | } |
bool wabt::isa<wabt::MemoryBinaryExpr<(wabt::ExprType)28>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 534 | bool isa(const Base* base) { | 66 | 534 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 534 | return Derived::classof(base); | 68 | 534 | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)29>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.89k | bool isa(const Base* base) { | 66 | 1.89k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.89k | return Derived::classof(base); | 68 | 1.89k | } |
bool wabt::isa<wabt::MemoryExpr<(wabt::ExprType)30>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 582 | bool isa(const Base* base) { | 66 | 582 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 582 | return Derived::classof(base); | 68 | 582 | } |
bool wabt::isa<wabt::MemoryExpr<(wabt::ExprType)31>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 520 | bool isa(const Base* base) { | 66 | 520 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 520 | return Derived::classof(base); | 68 | 520 | } |
bool wabt::isa<wabt::MemoryVarExpr<(wabt::ExprType)32>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.72k | bool isa(const Base* base) { | 66 | 1.72k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.72k | return Derived::classof(base); | 68 | 1.72k | } |
bool wabt::isa<wabt::MemoryExpr<(wabt::ExprType)33>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 3.06k | bool isa(const Base* base) { | 66 | 3.06k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 3.06k | return Derived::classof(base); | 68 | 3.06k | } |
bool wabt::isa<wabt::TableCopyExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 4.67k | bool isa(const Base* base) { | 66 | 4.67k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 4.67k | return Derived::classof(base); | 68 | 4.67k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)51>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 2.41k | bool isa(const Base* base) { | 66 | 2.41k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 2.41k | return Derived::classof(base); | 68 | 2.41k | } |
bool wabt::isa<wabt::TableInitExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 7.90k | bool isa(const Base* base) { | 66 | 7.90k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 7.90k | return Derived::classof(base); | 68 | 7.90k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)53>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.76k | bool isa(const Base* base) { | 66 | 1.76k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.76k | return Derived::classof(base); | 68 | 1.76k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)56>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 2.44k | bool isa(const Base* base) { | 66 | 2.44k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 2.44k | return Derived::classof(base); | 68 | 2.44k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)54>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.82k | bool isa(const Base* base) { | 66 | 1.82k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.82k | return Derived::classof(base); | 68 | 1.82k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)55>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 2.46k | bool isa(const Base* base) { | 66 | 2.46k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 2.46k | return Derived::classof(base); | 68 | 2.46k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)57>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 2.21k | bool isa(const Base* base) { | 66 | 2.21k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 2.21k | return Derived::classof(base); | 68 | 2.21k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)36>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 135k | bool isa(const Base* base) { | 66 | 135k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 135k | return Derived::classof(base); | 68 | 135k | } |
bool wabt::isa<wabt::RefTypeExpr<(wabt::ExprType)37>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 194 | bool isa(const Base* base) { | 66 | 194 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 194 | return Derived::classof(base); | 68 | 194 | } |
bool wabt::isa<wabt::ExprMixin<(wabt::ExprType)35>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 706 | bool isa(const Base* base) { | 66 | 706 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 706 | return Derived::classof(base); | 68 | 706 | } |
bool wabt::isa<wabt::ExprMixin<(wabt::ExprType)34>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 125k | bool isa(const Base* base) { | 66 | 125k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 125k | return Derived::classof(base); | 68 | 125k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)38>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 520 | bool isa(const Base* base) { | 66 | 520 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 520 | return Derived::classof(base); | 68 | 520 | } |
bool wabt::isa<wabt::ExprMixin<(wabt::ExprType)39>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.05k | bool isa(const Base* base) { | 66 | 1.05k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.05k | return Derived::classof(base); | 68 | 1.05k | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)40>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.71k | bool isa(const Base* base) { | 66 | 1.71k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.71k | return Derived::classof(base); | 68 | 1.71k | } |
bool wabt::isa<wabt::ReturnCallIndirectExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 4.50k | bool isa(const Base* base) { | 66 | 4.50k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 4.50k | return Derived::classof(base); | 68 | 4.50k | } |
bool wabt::isa<wabt::SelectExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 208 | bool isa(const Base* base) { | 66 | 208 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 208 | return Derived::classof(base); | 68 | 208 | } |
bool wabt::isa<wabt::LoadStoreExpr<(wabt::ExprType)49>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 686 | bool isa(const Base* base) { | 66 | 686 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 686 | return Derived::classof(base); | 68 | 686 | } |
bool wabt::isa<wabt::VarExpr<(wabt::ExprType)59>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 3.60k | bool isa(const Base* base) { | 66 | 3.60k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 3.60k | return Derived::classof(base); | 68 | 3.60k | } |
bool wabt::isa<wabt::ExprMixin<(wabt::ExprType)60>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 458 | bool isa(const Base* base) { | 66 | 458 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 458 | return Derived::classof(base); | 68 | 458 | } |
bool wabt::isa<wabt::OpcodeExpr<(wabt::ExprType)63>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 1.20k | bool isa(const Base* base) { | 66 | 1.20k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 1.20k | return Derived::classof(base); | 68 | 1.20k | } |
bool wabt::isa<wabt::OpcodeExpr<(wabt::ExprType)58>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 658 | bool isa(const Base* base) { | 66 | 658 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 658 | return Derived::classof(base); | 68 | 658 | } |
bool wabt::isa<wabt::SimdLaneOpExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 208 | bool isa(const Base* base) { | 66 | 208 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 208 | return Derived::classof(base); | 68 | 208 | } |
bool wabt::isa<wabt::SimdLoadLaneExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 520 | bool isa(const Base* base) { | 66 | 520 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 520 | return Derived::classof(base); | 68 | 520 | } |
bool wabt::isa<wabt::SimdStoreLaneExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 754 | bool isa(const Base* base) { | 66 | 754 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 754 | return Derived::classof(base); | 68 | 754 | } |
bool wabt::isa<wabt::SimdShuffleOpExpr, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 454 | bool isa(const Base* base) { | 66 | 454 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 454 | return Derived::classof(base); | 68 | 454 | } |
bool wabt::isa<wabt::ExprMixin<(wabt::ExprType)64>, wabt::Expr>(wabt::Expr const*) Line | Count | Source | 65 | 258 | bool isa(const Base* base) { | 66 | 258 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 258 | return Derived::classof(base); | 68 | 258 | } |
bool wabt::isa<wabt::FuncType, wabt::TypeEntry>(wabt::TypeEntry const*) Line | Count | Source | 65 | 2.29M | bool isa(const Base* base) { | 66 | 2.29M | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 2.29M | return Derived::classof(base); | 68 | 2.29M | } |
bool wabt::isa<wabt::TableImport, wabt::Import>(wabt::Import const*) Line | Count | Source | 65 | 17.2k | bool isa(const Base* base) { | 66 | 17.2k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 17.2k | return Derived::classof(base); | 68 | 17.2k | } |
bool wabt::isa<wabt::MemoryImport, wabt::Import>(wabt::Import const*) Line | Count | Source | 65 | 698 | bool isa(const Base* base) { | 66 | 698 | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 698 | return Derived::classof(base); | 68 | 698 | } |
bool wabt::isa<wabt::GlobalImport, wabt::Import>(wabt::Import const*) Line | Count | Source | 65 | 26.3k | bool isa(const Base* base) { | 66 | 26.3k | WABT_STATIC_ASSERT((std::is_base_of<Base, Derived>::value)); | 67 | 26.3k | return Derived::classof(base); | 68 | 26.3k | } |
Unexecuted instantiation: bool wabt::isa<wabt::GlobalModuleField, wabt::ModuleField>(wabt::ModuleField const*) Unexecuted instantiation: bool wabt::isa<wabt::TypeModuleField, wabt::ModuleField>(wabt::ModuleField const*) Unexecuted instantiation: bool wabt::isa<wabt::TableModuleField, wabt::ModuleField>(wabt::ModuleField const*) Unexecuted instantiation: bool wabt::isa<wabt::ElemSegmentModuleField, wabt::ModuleField>(wabt::ModuleField const*) Unexecuted instantiation: bool wabt::isa<wabt::MemoryModuleField, wabt::ModuleField>(wabt::ModuleField const*) Unexecuted instantiation: bool wabt::isa<wabt::DataSegmentModuleField, wabt::ModuleField>(wabt::ModuleField const*) Unexecuted instantiation: bool wabt::isa<wabt::StartModuleField, wabt::ModuleField>(wabt::ModuleField const*) Unexecuted instantiation: bool wabt::isa<wabt::AssertModuleCommand<(wabt::CommandType)5>, wabt::Command>(wabt::Command const*) Unexecuted instantiation: bool wabt::isa<wabt::AssertModuleCommand<(wabt::CommandType)6>, wabt::Command>(wabt::Command const*) Unexecuted instantiation: bool wabt::isa<wabt::AssertModuleCommand<(wabt::CommandType)7>, wabt::Command>(wabt::Command const*) |
69 | | |
70 | | template <typename Derived, typename Base> |
71 | | const Derived* cast(const Base* base) { |
72 | | assert(isa<Derived>(base)); |
73 | | return static_cast<const Derived*>(base); |
74 | | }; |
75 | | |
76 | | template <typename Derived, typename Base> |
77 | 944k | Derived* cast(Base* base) { |
78 | 944k | assert(isa<Derived>(base)); |
79 | 944k | return static_cast<Derived*>(base); |
80 | 944k | }; wabt::ExportModuleField* wabt::cast<wabt::ExportModuleField, wabt::ModuleField>(wabt::ModuleField*) Line | Count | Source | 77 | 42.4k | Derived* cast(Base* base) { | 78 | 42.4k | assert(isa<Derived>(base)); | 79 | 42.4k | return static_cast<Derived*>(base); | 80 | 42.4k | }; |
wabt::TextScriptModule* wabt::cast<wabt::TextScriptModule, wabt::ScriptModule>(wabt::ScriptModule*) Line | Count | Source | 77 | 54 | Derived* cast(Base* base) { | 78 | 54 | assert(isa<Derived>(base)); | 79 | 54 | return static_cast<Derived*>(base); | 80 | 54 | }; |
Unexecuted instantiation: wabt::DataScriptModule<(wabt::ScriptModuleType)1>* wabt::cast<wabt::DataScriptModule<(wabt::ScriptModuleType)1>, wabt::ScriptModule>(wabt::ScriptModule*) Unexecuted instantiation: wabt::DataScriptModule<(wabt::ScriptModuleType)2>* wabt::cast<wabt::DataScriptModule<(wabt::ScriptModuleType)2>, wabt::ScriptModule>(wabt::ScriptModule*) wabt::TryExpr* wabt::cast<wabt::TryExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 154k | Derived* cast(Base* base) { | 78 | 154k | assert(isa<Derived>(base)); | 79 | 154k | return static_cast<Derived*>(base); | 80 | 154k | }; |
wabt::IfExpr* wabt::cast<wabt::IfExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 13.0k | Derived* cast(Base* base) { | 78 | 13.0k | assert(isa<Derived>(base)); | 79 | 13.0k | return static_cast<Derived*>(base); | 80 | 13.0k | }; |
wabt::BlockExprBase<(wabt::ExprType)8>* wabt::cast<wabt::BlockExprBase<(wabt::ExprType)8>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 22.1k | Derived* cast(Base* base) { | 78 | 22.1k | assert(isa<Derived>(base)); | 79 | 22.1k | return static_cast<Derived*>(base); | 80 | 22.1k | }; |
wabt::BlockExprBase<(wabt::ExprType)27>* wabt::cast<wabt::BlockExprBase<(wabt::ExprType)27>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 119k | Derived* cast(Base* base) { | 78 | 119k | assert(isa<Derived>(base)); | 79 | 119k | return static_cast<Derived*>(base); | 80 | 119k | }; |
wabt::TryTableExpr* wabt::cast<wabt::TryTableExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 7.21k | Derived* cast(Base* base) { | 78 | 7.21k | assert(isa<Derived>(base)); | 79 | 7.21k | return static_cast<Derived*>(base); | 80 | 7.21k | }; |
wabt::LoadStoreExpr<(wabt::ExprType)0>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)0>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 564 | Derived* cast(Base* base) { | 78 | 564 | assert(isa<Derived>(base)); | 79 | 564 | return static_cast<Derived*>(base); | 80 | 564 | }; |
wabt::LoadStoreExpr<(wabt::ExprType)3>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)3>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.12k | Derived* cast(Base* base) { | 78 | 1.12k | assert(isa<Derived>(base)); | 79 | 1.12k | return static_cast<Derived*>(base); | 80 | 1.12k | }; |
wabt::LoadStoreExpr<(wabt::ExprType)1>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)1>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.70k | Derived* cast(Base* base) { | 78 | 1.70k | assert(isa<Derived>(base)); | 79 | 1.70k | return static_cast<Derived*>(base); | 80 | 1.70k | }; |
wabt::LoadStoreExpr<(wabt::ExprType)2>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)2>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 197 | Derived* cast(Base* base) { | 78 | 197 | assert(isa<Derived>(base)); | 79 | 197 | return static_cast<Derived*>(base); | 80 | 197 | }; |
wabt::LoadStoreExpr<(wabt::ExprType)6>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)6>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 514 | Derived* cast(Base* base) { | 78 | 514 | assert(isa<Derived>(base)); | 79 | 514 | return static_cast<Derived*>(base); | 80 | 514 | }; |
wabt::AtomicFenceExpr* wabt::cast<wabt::AtomicFenceExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 746 | Derived* cast(Base* base) { | 78 | 746 | assert(isa<Derived>(base)); | 79 | 746 | return static_cast<Derived*>(base); | 80 | 746 | }; |
wabt::LoadStoreExpr<(wabt::ExprType)4>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)4>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 666 | Derived* cast(Base* base) { | 78 | 666 | assert(isa<Derived>(base)); | 79 | 666 | return static_cast<Derived*>(base); | 80 | 666 | }; |
wabt::OpcodeExpr<(wabt::ExprType)7>* wabt::cast<wabt::OpcodeExpr<(wabt::ExprType)7>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 737 | Derived* cast(Base* base) { | 78 | 737 | assert(isa<Derived>(base)); | 79 | 737 | return static_cast<Derived*>(base); | 80 | 737 | }; |
wabt::VarExpr<(wabt::ExprType)9>* wabt::cast<wabt::VarExpr<(wabt::ExprType)9>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 7.20k | Derived* cast(Base* base) { | 78 | 7.20k | assert(isa<Derived>(base)); | 79 | 7.20k | return static_cast<Derived*>(base); | 80 | 7.20k | }; |
wabt::VarExpr<(wabt::ExprType)10>* wabt::cast<wabt::VarExpr<(wabt::ExprType)10>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 555 | Derived* cast(Base* base) { | 78 | 555 | assert(isa<Derived>(base)); | 79 | 555 | return static_cast<Derived*>(base); | 80 | 555 | }; |
wabt::BrTableExpr* wabt::cast<wabt::BrTableExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.15k | Derived* cast(Base* base) { | 78 | 1.15k | assert(isa<Derived>(base)); | 79 | 1.15k | return static_cast<Derived*>(base); | 80 | 1.15k | }; |
wabt::VarExpr<(wabt::ExprType)12>* wabt::cast<wabt::VarExpr<(wabt::ExprType)12>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 4.42k | Derived* cast(Base* base) { | 78 | 4.42k | assert(isa<Derived>(base)); | 79 | 4.42k | return static_cast<Derived*>(base); | 80 | 4.42k | }; |
wabt::CallIndirectExpr* wabt::cast<wabt::CallIndirectExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 4.50k | Derived* cast(Base* base) { | 78 | 4.50k | assert(isa<Derived>(base)); | 79 | 4.50k | return static_cast<Derived*>(base); | 80 | 4.50k | }; |
wabt::CallRefExpr* wabt::cast<wabt::CallRefExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 194 | Derived* cast(Base* base) { | 78 | 194 | assert(isa<Derived>(base)); | 79 | 194 | return static_cast<Derived*>(base); | 80 | 194 | }; |
wabt::CodeMetadataExpr* wabt::cast<wabt::CodeMetadataExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.74k | Derived* cast(Base* base) { | 78 | 1.74k | assert(isa<Derived>(base)); | 79 | 1.74k | return static_cast<Derived*>(base); | 80 | 1.74k | }; |
wabt::OpcodeExpr<(wabt::ExprType)16>* wabt::cast<wabt::OpcodeExpr<(wabt::ExprType)16>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 644 | Derived* cast(Base* base) { | 78 | 644 | assert(isa<Derived>(base)); | 79 | 644 | return static_cast<Derived*>(base); | 80 | 644 | }; |
wabt::ConstExpr* wabt::cast<wabt::ConstExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 52.9k | Derived* cast(Base* base) { | 78 | 52.9k | assert(isa<Derived>(base)); | 79 | 52.9k | return static_cast<Derived*>(base); | 80 | 52.9k | }; |
wabt::OpcodeExpr<(wabt::ExprType)18>* wabt::cast<wabt::OpcodeExpr<(wabt::ExprType)18>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 196 | Derived* cast(Base* base) { | 78 | 196 | assert(isa<Derived>(base)); | 79 | 196 | return static_cast<Derived*>(base); | 80 | 196 | }; |
wabt::ExprMixin<(wabt::ExprType)19>* wabt::cast<wabt::ExprMixin<(wabt::ExprType)19>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 312 | Derived* cast(Base* base) { | 78 | 312 | assert(isa<Derived>(base)); | 79 | 312 | return static_cast<Derived*>(base); | 80 | 312 | }; |
wabt::VarExpr<(wabt::ExprType)20>* wabt::cast<wabt::VarExpr<(wabt::ExprType)20>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.77k | Derived* cast(Base* base) { | 78 | 1.77k | assert(isa<Derived>(base)); | 79 | 1.77k | return static_cast<Derived*>(base); | 80 | 1.77k | }; |
wabt::VarExpr<(wabt::ExprType)21>* wabt::cast<wabt::VarExpr<(wabt::ExprType)21>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.49k | Derived* cast(Base* base) { | 78 | 1.49k | assert(isa<Derived>(base)); | 79 | 1.49k | return static_cast<Derived*>(base); | 80 | 1.49k | }; |
wabt::LoadStoreExpr<(wabt::ExprType)23>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)23>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.22k | Derived* cast(Base* base) { | 78 | 1.22k | assert(isa<Derived>(base)); | 79 | 1.22k | return static_cast<Derived*>(base); | 80 | 1.22k | }; |
Unexecuted instantiation: wabt::LoadStoreExpr<(wabt::ExprType)47>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)47>, wabt::Expr>(wabt::Expr*) Unexecuted instantiation: wabt::LoadStoreExpr<(wabt::ExprType)48>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)48>, wabt::Expr>(wabt::Expr*) wabt::VarExpr<(wabt::ExprType)24>* wabt::cast<wabt::VarExpr<(wabt::ExprType)24>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.88k | Derived* cast(Base* base) { | 78 | 1.88k | assert(isa<Derived>(base)); | 79 | 1.88k | return static_cast<Derived*>(base); | 80 | 1.88k | }; |
wabt::VarExpr<(wabt::ExprType)25>* wabt::cast<wabt::VarExpr<(wabt::ExprType)25>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.89k | Derived* cast(Base* base) { | 78 | 1.89k | assert(isa<Derived>(base)); | 79 | 1.89k | return static_cast<Derived*>(base); | 80 | 1.89k | }; |
wabt::VarExpr<(wabt::ExprType)26>* wabt::cast<wabt::VarExpr<(wabt::ExprType)26>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.92k | Derived* cast(Base* base) { | 78 | 1.92k | assert(isa<Derived>(base)); | 79 | 1.92k | return static_cast<Derived*>(base); | 80 | 1.92k | }; |
wabt::MemoryBinaryExpr<(wabt::ExprType)28>* wabt::cast<wabt::MemoryBinaryExpr<(wabt::ExprType)28>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 534 | Derived* cast(Base* base) { | 78 | 534 | assert(isa<Derived>(base)); | 79 | 534 | return static_cast<Derived*>(base); | 80 | 534 | }; |
wabt::VarExpr<(wabt::ExprType)29>* wabt::cast<wabt::VarExpr<(wabt::ExprType)29>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.89k | Derived* cast(Base* base) { | 78 | 1.89k | assert(isa<Derived>(base)); | 79 | 1.89k | return static_cast<Derived*>(base); | 80 | 1.89k | }; |
wabt::MemoryExpr<(wabt::ExprType)30>* wabt::cast<wabt::MemoryExpr<(wabt::ExprType)30>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 582 | Derived* cast(Base* base) { | 78 | 582 | assert(isa<Derived>(base)); | 79 | 582 | return static_cast<Derived*>(base); | 80 | 582 | }; |
wabt::MemoryExpr<(wabt::ExprType)31>* wabt::cast<wabt::MemoryExpr<(wabt::ExprType)31>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 520 | Derived* cast(Base* base) { | 78 | 520 | assert(isa<Derived>(base)); | 79 | 520 | return static_cast<Derived*>(base); | 80 | 520 | }; |
wabt::MemoryVarExpr<(wabt::ExprType)32>* wabt::cast<wabt::MemoryVarExpr<(wabt::ExprType)32>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.72k | Derived* cast(Base* base) { | 78 | 1.72k | assert(isa<Derived>(base)); | 79 | 1.72k | return static_cast<Derived*>(base); | 80 | 1.72k | }; |
wabt::MemoryExpr<(wabt::ExprType)33>* wabt::cast<wabt::MemoryExpr<(wabt::ExprType)33>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 3.06k | Derived* cast(Base* base) { | 78 | 3.06k | assert(isa<Derived>(base)); | 79 | 3.06k | return static_cast<Derived*>(base); | 80 | 3.06k | }; |
wabt::TableCopyExpr* wabt::cast<wabt::TableCopyExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 4.67k | Derived* cast(Base* base) { | 78 | 4.67k | assert(isa<Derived>(base)); | 79 | 4.67k | return static_cast<Derived*>(base); | 80 | 4.67k | }; |
wabt::VarExpr<(wabt::ExprType)51>* wabt::cast<wabt::VarExpr<(wabt::ExprType)51>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 2.41k | Derived* cast(Base* base) { | 78 | 2.41k | assert(isa<Derived>(base)); | 79 | 2.41k | return static_cast<Derived*>(base); | 80 | 2.41k | }; |
wabt::TableInitExpr* wabt::cast<wabt::TableInitExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 7.90k | Derived* cast(Base* base) { | 78 | 7.90k | assert(isa<Derived>(base)); | 79 | 7.90k | return static_cast<Derived*>(base); | 80 | 7.90k | }; |
wabt::VarExpr<(wabt::ExprType)53>* wabt::cast<wabt::VarExpr<(wabt::ExprType)53>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.76k | Derived* cast(Base* base) { | 78 | 1.76k | assert(isa<Derived>(base)); | 79 | 1.76k | return static_cast<Derived*>(base); | 80 | 1.76k | }; |
wabt::VarExpr<(wabt::ExprType)56>* wabt::cast<wabt::VarExpr<(wabt::ExprType)56>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 2.44k | Derived* cast(Base* base) { | 78 | 2.44k | assert(isa<Derived>(base)); | 79 | 2.44k | return static_cast<Derived*>(base); | 80 | 2.44k | }; |
wabt::VarExpr<(wabt::ExprType)54>* wabt::cast<wabt::VarExpr<(wabt::ExprType)54>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.82k | Derived* cast(Base* base) { | 78 | 1.82k | assert(isa<Derived>(base)); | 79 | 1.82k | return static_cast<Derived*>(base); | 80 | 1.82k | }; |
wabt::VarExpr<(wabt::ExprType)55>* wabt::cast<wabt::VarExpr<(wabt::ExprType)55>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 2.46k | Derived* cast(Base* base) { | 78 | 2.46k | assert(isa<Derived>(base)); | 79 | 2.46k | return static_cast<Derived*>(base); | 80 | 2.46k | }; |
wabt::VarExpr<(wabt::ExprType)57>* wabt::cast<wabt::VarExpr<(wabt::ExprType)57>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 2.21k | Derived* cast(Base* base) { | 78 | 2.21k | assert(isa<Derived>(base)); | 79 | 2.21k | return static_cast<Derived*>(base); | 80 | 2.21k | }; |
wabt::VarExpr<(wabt::ExprType)36>* wabt::cast<wabt::VarExpr<(wabt::ExprType)36>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 135k | Derived* cast(Base* base) { | 78 | 135k | assert(isa<Derived>(base)); | 79 | 135k | return static_cast<Derived*>(base); | 80 | 135k | }; |
wabt::RefTypeExpr<(wabt::ExprType)37>* wabt::cast<wabt::RefTypeExpr<(wabt::ExprType)37>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 194 | Derived* cast(Base* base) { | 78 | 194 | assert(isa<Derived>(base)); | 79 | 194 | return static_cast<Derived*>(base); | 80 | 194 | }; |
wabt::ExprMixin<(wabt::ExprType)35>* wabt::cast<wabt::ExprMixin<(wabt::ExprType)35>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 706 | Derived* cast(Base* base) { | 78 | 706 | assert(isa<Derived>(base)); | 79 | 706 | return static_cast<Derived*>(base); | 80 | 706 | }; |
wabt::ExprMixin<(wabt::ExprType)34>* wabt::cast<wabt::ExprMixin<(wabt::ExprType)34>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 125k | Derived* cast(Base* base) { | 78 | 125k | assert(isa<Derived>(base)); | 79 | 125k | return static_cast<Derived*>(base); | 80 | 125k | }; |
wabt::VarExpr<(wabt::ExprType)38>* wabt::cast<wabt::VarExpr<(wabt::ExprType)38>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 520 | Derived* cast(Base* base) { | 78 | 520 | assert(isa<Derived>(base)); | 79 | 520 | return static_cast<Derived*>(base); | 80 | 520 | }; |
wabt::ExprMixin<(wabt::ExprType)39>* wabt::cast<wabt::ExprMixin<(wabt::ExprType)39>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.05k | Derived* cast(Base* base) { | 78 | 1.05k | assert(isa<Derived>(base)); | 79 | 1.05k | return static_cast<Derived*>(base); | 80 | 1.05k | }; |
wabt::VarExpr<(wabt::ExprType)40>* wabt::cast<wabt::VarExpr<(wabt::ExprType)40>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.71k | Derived* cast(Base* base) { | 78 | 1.71k | assert(isa<Derived>(base)); | 79 | 1.71k | return static_cast<Derived*>(base); | 80 | 1.71k | }; |
wabt::ReturnCallIndirectExpr* wabt::cast<wabt::ReturnCallIndirectExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 4.50k | Derived* cast(Base* base) { | 78 | 4.50k | assert(isa<Derived>(base)); | 79 | 4.50k | return static_cast<Derived*>(base); | 80 | 4.50k | }; |
wabt::SelectExpr* wabt::cast<wabt::SelectExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 208 | Derived* cast(Base* base) { | 78 | 208 | assert(isa<Derived>(base)); | 79 | 208 | return static_cast<Derived*>(base); | 80 | 208 | }; |
wabt::LoadStoreExpr<(wabt::ExprType)49>* wabt::cast<wabt::LoadStoreExpr<(wabt::ExprType)49>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 686 | Derived* cast(Base* base) { | 78 | 686 | assert(isa<Derived>(base)); | 79 | 686 | return static_cast<Derived*>(base); | 80 | 686 | }; |
wabt::VarExpr<(wabt::ExprType)59>* wabt::cast<wabt::VarExpr<(wabt::ExprType)59>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 3.60k | Derived* cast(Base* base) { | 78 | 3.60k | assert(isa<Derived>(base)); | 79 | 3.60k | return static_cast<Derived*>(base); | 80 | 3.60k | }; |
wabt::ExprMixin<(wabt::ExprType)60>* wabt::cast<wabt::ExprMixin<(wabt::ExprType)60>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 458 | Derived* cast(Base* base) { | 78 | 458 | assert(isa<Derived>(base)); | 79 | 458 | return static_cast<Derived*>(base); | 80 | 458 | }; |
wabt::OpcodeExpr<(wabt::ExprType)63>* wabt::cast<wabt::OpcodeExpr<(wabt::ExprType)63>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 1.20k | Derived* cast(Base* base) { | 78 | 1.20k | assert(isa<Derived>(base)); | 79 | 1.20k | return static_cast<Derived*>(base); | 80 | 1.20k | }; |
wabt::OpcodeExpr<(wabt::ExprType)58>* wabt::cast<wabt::OpcodeExpr<(wabt::ExprType)58>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 658 | Derived* cast(Base* base) { | 78 | 658 | assert(isa<Derived>(base)); | 79 | 658 | return static_cast<Derived*>(base); | 80 | 658 | }; |
wabt::SimdLaneOpExpr* wabt::cast<wabt::SimdLaneOpExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 208 | Derived* cast(Base* base) { | 78 | 208 | assert(isa<Derived>(base)); | 79 | 208 | return static_cast<Derived*>(base); | 80 | 208 | }; |
wabt::SimdLoadLaneExpr* wabt::cast<wabt::SimdLoadLaneExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 520 | Derived* cast(Base* base) { | 78 | 520 | assert(isa<Derived>(base)); | 79 | 520 | return static_cast<Derived*>(base); | 80 | 520 | }; |
wabt::SimdStoreLaneExpr* wabt::cast<wabt::SimdStoreLaneExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 754 | Derived* cast(Base* base) { | 78 | 754 | assert(isa<Derived>(base)); | 79 | 754 | return static_cast<Derived*>(base); | 80 | 754 | }; |
wabt::SimdShuffleOpExpr* wabt::cast<wabt::SimdShuffleOpExpr, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 454 | Derived* cast(Base* base) { | 78 | 454 | assert(isa<Derived>(base)); | 79 | 454 | return static_cast<Derived*>(base); | 80 | 454 | }; |
wabt::ExprMixin<(wabt::ExprType)64>* wabt::cast<wabt::ExprMixin<(wabt::ExprType)64>, wabt::Expr>(wabt::Expr*) Line | Count | Source | 77 | 258 | Derived* cast(Base* base) { | 78 | 258 | assert(isa<Derived>(base)); | 79 | 258 | return static_cast<Derived*>(base); | 80 | 258 | }; |
wabt::FuncImport* wabt::cast<wabt::FuncImport, wabt::Import>(wabt::Import*) Line | Count | Source | 77 | 73.5k | Derived* cast(Base* base) { | 78 | 73.5k | assert(isa<Derived>(base)); | 79 | 73.5k | return static_cast<Derived*>(base); | 80 | 73.5k | }; |
wabt::TableImport* wabt::cast<wabt::TableImport, wabt::Import>(wabt::Import*) Line | Count | Source | 77 | 17.2k | Derived* cast(Base* base) { | 78 | 17.2k | assert(isa<Derived>(base)); | 79 | 17.2k | return static_cast<Derived*>(base); | 80 | 17.2k | }; |
wabt::MemoryImport* wabt::cast<wabt::MemoryImport, wabt::Import>(wabt::Import*) Line | Count | Source | 77 | 698 | Derived* cast(Base* base) { | 78 | 698 | assert(isa<Derived>(base)); | 79 | 698 | return static_cast<Derived*>(base); | 80 | 698 | }; |
wabt::GlobalImport* wabt::cast<wabt::GlobalImport, wabt::Import>(wabt::Import*) Line | Count | Source | 77 | 26.3k | Derived* cast(Base* base) { | 78 | 26.3k | assert(isa<Derived>(base)); | 79 | 26.3k | return static_cast<Derived*>(base); | 80 | 26.3k | }; |
wabt::TagImport* wabt::cast<wabt::TagImport, wabt::Import>(wabt::Import*) Line | Count | Source | 77 | 63.9k | Derived* cast(Base* base) { | 78 | 63.9k | assert(isa<Derived>(base)); | 79 | 63.9k | return static_cast<Derived*>(base); | 80 | 63.9k | }; |
Unexecuted instantiation: wabt::ModuleCommand* wabt::cast<wabt::ModuleCommand, wabt::Command>(wabt::Command*) Unexecuted instantiation: wabt::ScriptModuleCommand* wabt::cast<wabt::ScriptModuleCommand, wabt::Command>(wabt::Command*) Unexecuted instantiation: wabt::AssertModuleCommand<(wabt::CommandType)5>* wabt::cast<wabt::AssertModuleCommand<(wabt::CommandType)5>, wabt::Command>(wabt::Command*) Unexecuted instantiation: wabt::AssertModuleCommand<(wabt::CommandType)6>* wabt::cast<wabt::AssertModuleCommand<(wabt::CommandType)6>, wabt::Command>(wabt::Command*) Unexecuted instantiation: wabt::AssertModuleCommand<(wabt::CommandType)7>* wabt::cast<wabt::AssertModuleCommand<(wabt::CommandType)7>, wabt::Command>(wabt::Command*) |
81 | | |
82 | | template <typename Derived, typename Base> |
83 | | const Derived* dyn_cast(const Base* base) { |
84 | | return isa<Derived>(base) ? static_cast<const Derived*>(base) : nullptr; |
85 | | }; |
86 | | |
87 | | template <typename Derived, typename Base> |
88 | 5.56M | Derived* dyn_cast(Base* base) { |
89 | 5.56M | return isa<Derived>(base) ? static_cast<Derived*>(base) : nullptr; |
90 | 5.56M | }; wabt::FuncModuleField* wabt::dyn_cast<wabt::FuncModuleField, wabt::ModuleField>(wabt::ModuleField*) Line | Count | Source | 88 | 1.70M | Derived* dyn_cast(Base* base) { | 89 | 1.70M | return isa<Derived>(base) ? static_cast<Derived*>(base) : nullptr; | 90 | 1.70M | }; |
wabt::TagModuleField* wabt::dyn_cast<wabt::TagModuleField, wabt::ModuleField>(wabt::ModuleField*) Line | Count | Source | 88 | 717k | Derived* dyn_cast(Base* base) { | 89 | 717k | return isa<Derived>(base) ? static_cast<Derived*>(base) : nullptr; | 90 | 717k | }; |
wabt::ImportModuleField* wabt::dyn_cast<wabt::ImportModuleField, wabt::ModuleField>(wabt::ModuleField*) Line | Count | Source | 88 | 717k | Derived* dyn_cast(Base* base) { | 89 | 717k | return isa<Derived>(base) ? static_cast<Derived*>(base) : nullptr; | 90 | 717k | }; |
wabt::FuncImport* wabt::dyn_cast<wabt::FuncImport, wabt::Import>(wabt::Import*) Line | Count | Source | 88 | 68.7k | Derived* dyn_cast(Base* base) { | 89 | 68.7k | return isa<Derived>(base) ? static_cast<Derived*>(base) : nullptr; | 90 | 68.7k | }; |
wabt::TagImport* wabt::dyn_cast<wabt::TagImport, wabt::Import>(wabt::Import*) Line | Count | Source | 88 | 62.5k | Derived* dyn_cast(Base* base) { | 89 | 62.5k | return isa<Derived>(base) ? static_cast<Derived*>(base) : nullptr; | 90 | 62.5k | }; |
wabt::FuncType* wabt::dyn_cast<wabt::FuncType, wabt::TypeEntry>(wabt::TypeEntry*) Line | Count | Source | 88 | 2.29M | Derived* dyn_cast(Base* base) { | 89 | 2.29M | return isa<Derived>(base) ? static_cast<Derived*>(base) : nullptr; | 90 | 2.29M | }; |
Unexecuted instantiation: wabt::ModuleCommand* wabt::dyn_cast<wabt::ModuleCommand, wabt::Command>(wabt::Command*) Unexecuted instantiation: wabt::TextScriptModule* wabt::dyn_cast<wabt::TextScriptModule, wabt::ScriptModule>(wabt::ScriptModule*) |
91 | | |
92 | | // Cast functionality for unique_ptr. isa and dyn_cast are not included because |
93 | | // they won't always pass ownership back to the caller. |
94 | | |
95 | | template <typename Derived, typename Base> |
96 | | std::unique_ptr<const Derived> cast(std::unique_ptr<const Base>&& base) { |
97 | | assert(isa<Derived>(base.get())); |
98 | | return std::unique_ptr<Derived>(static_cast<const Derived*>(base.release())); |
99 | | }; |
100 | | |
101 | | template <typename Derived, typename Base> |
102 | 42.5k | std::unique_ptr<Derived> cast(std::unique_ptr<Base>&& base) { |
103 | 42.5k | assert(isa<Derived>(base.get())); |
104 | 42.5k | return std::unique_ptr<Derived>(static_cast<Derived*>(base.release())); |
105 | 42.5k | }; std::__1::unique_ptr<wabt::ModuleCommand, std::__1::default_delete<wabt::ModuleCommand> > wabt::cast<wabt::ModuleCommand, wabt::Command>(std::__1::unique_ptr<wabt::Command, std::__1::default_delete<wabt::Command> >&&) Line | Count | Source | 102 | 54 | std::unique_ptr<Derived> cast(std::unique_ptr<Base>&& base) { | 103 | 54 | assert(isa<Derived>(base.get())); | 104 | 54 | return std::unique_ptr<Derived>(static_cast<Derived*>(base.release())); | 105 | 54 | }; |
Unexecuted instantiation: std::__1::unique_ptr<wabt::ScriptModuleCommand, std::__1::default_delete<wabt::ScriptModuleCommand> > wabt::cast<wabt::ScriptModuleCommand, wabt::Command>(std::__1::unique_ptr<wabt::Command, std::__1::default_delete<wabt::Command> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::FuncModuleField, std::__1::default_delete<wabt::FuncModuleField> > wabt::cast<wabt::FuncModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::GlobalModuleField, std::__1::default_delete<wabt::GlobalModuleField> > wabt::cast<wabt::GlobalModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::ImportModuleField, std::__1::default_delete<wabt::ImportModuleField> > wabt::cast<wabt::ImportModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) std::__1::unique_ptr<wabt::ExportModuleField, std::__1::default_delete<wabt::ExportModuleField> > wabt::cast<wabt::ExportModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Line | Count | Source | 102 | 42.4k | std::unique_ptr<Derived> cast(std::unique_ptr<Base>&& base) { | 103 | 42.4k | assert(isa<Derived>(base.get())); | 104 | 42.4k | return std::unique_ptr<Derived>(static_cast<Derived*>(base.release())); | 105 | 42.4k | }; |
Unexecuted instantiation: std::__1::unique_ptr<wabt::TypeModuleField, std::__1::default_delete<wabt::TypeModuleField> > wabt::cast<wabt::TypeModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::TableModuleField, std::__1::default_delete<wabt::TableModuleField> > wabt::cast<wabt::TableModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::ElemSegmentModuleField, std::__1::default_delete<wabt::ElemSegmentModuleField> > wabt::cast<wabt::ElemSegmentModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::MemoryModuleField, std::__1::default_delete<wabt::MemoryModuleField> > wabt::cast<wabt::MemoryModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::DataSegmentModuleField, std::__1::default_delete<wabt::DataSegmentModuleField> > wabt::cast<wabt::DataSegmentModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::StartModuleField, std::__1::default_delete<wabt::StartModuleField> > wabt::cast<wabt::StartModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) Unexecuted instantiation: std::__1::unique_ptr<wabt::TagModuleField, std::__1::default_delete<wabt::TagModuleField> > wabt::cast<wabt::TagModuleField, wabt::ModuleField>(std::__1::unique_ptr<wabt::ModuleField, std::__1::default_delete<wabt::ModuleField> >&&) |
106 | | |
107 | | } // namespace wabt |
108 | | |
109 | | #endif // WABT_CAST_H_ |