summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-12-17 13:55:01 -0800
committerGitHub <noreply@github.com>2019-12-17 13:55:01 -0800
commit323e475a3ab57fe4ffd0b5826af5f6cbf0061265 (patch)
treeec8a06b85eeadc4a3ec4a66fcd6a1950b7569b2d /src/wasm.h
parentf0a2e2c75c7bb3008f10b6edbb8dc4cfd27b7d28 (diff)
downloadbinaryen-323e475a3ab57fe4ffd0b5826af5f6cbf0061265.tar.gz
binaryen-323e475a3ab57fe4ffd0b5826af5f6cbf0061265.tar.bz2
binaryen-323e475a3ab57fe4ffd0b5826af5f6cbf0061265.zip
Correctly clear memory / table info in clearModule (#2536)
Currently `ModuleUtils::clearModule` does not clear `exists` flags in the memory and table, and running RoundTrip pass on any module that has a memory or a table fails as a result. This creates `clear` function in `Memory` and `Table` and makes `clearModule` call them.
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h
index cc2070eb2..0ed4f27bd 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -1241,6 +1241,13 @@ public:
Table() { name = Name::fromInt(0); }
bool hasMax() { return max != kUnlimitedSize; }
+ void clear() {
+ exists = false;
+ name = "";
+ initial = 0;
+ max = kMaxSize;
+ segments.clear();
+ }
};
class Memory : public Importable {
@@ -1284,6 +1291,14 @@ public:
Memory() { name = Name::fromInt(0); }
bool hasMax() { return max != kUnlimitedSize; }
+ void clear() {
+ exists = false;
+ name = "";
+ initial = 0;
+ max = kMaxSize;
+ segments.clear();
+ shared = false;
+ }
};
class Global : public Importable {