diff options
Diffstat (limited to 'src/wasm-linker.cpp')
-rw-r--r-- | src/wasm-linker.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/wasm-linker.cpp b/src/wasm-linker.cpp index 4fb7ea4ae..7524f439a 100644 --- a/src/wasm-linker.cpp +++ b/src/wasm-linker.cpp @@ -16,6 +16,7 @@ #include "wasm-linker.h" #include "asm_v_wasm.h" +#include "ast_utils.h" #include "support/utilities.h" #include "wasm-builder.h" #include "wasm-printing.h" @@ -64,12 +65,9 @@ void Linker::layout() { // Change each call. The target is the same since it's still the name. // Delete and re-allocate the Expression as CallImport to avoid undefined // behavior. - static_assert(sizeof(Call) >= sizeof(CallImport), - "Cannot reallocate a CallImport in a Call arena slot"); for (auto* call : f.second) { Call callCopy = std::move(*call); - call->~Call(); - CallImport* newCall = new (call) CallImport; + CallImport* newCall = ExpressionManipulator::convert<Call, CallImport>(call); newCall->type = callCopy.type; newCall->operands = std::move(callCopy.operands); newCall->target = target; |