summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/fuzzing/fuzzing.cpp5
-rw-r--r--src/wasm/wasm-binary.cpp2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp
index 73aff5acb..45cfbde0f 100644
--- a/src/tools/fuzzing/fuzzing.cpp
+++ b/src/tools/fuzzing/fuzzing.cpp
@@ -263,6 +263,11 @@ void TranslateToFuzzReader::setupHeapTypes() {
// non-nullable bottom heap type).
if (!type.isBottom() && !type.isBasic()) {
interestingHeapTypes.push_back(type);
+ if (oneIn(2)) {
+ // Add a name for this type.
+ wasm.typeNames[type].name =
+ "generated_type$" + std::to_string(interestingHeapTypes.size());
+ }
}
}
}
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 5326972b0..89ad82abf 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -896,7 +896,7 @@ void WasmBinaryWriter::writeNames() {
// type names
{
std::vector<HeapType> namedTypes;
- for (auto& [type, _] : indexedTypes.indices) {
+ for (auto type : indexedTypes.types) {
if (wasm->typeNames.count(type) && wasm->typeNames[type].name.is()) {
namedTypes.push_back(type);
}