diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-02-08 17:16:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 17:16:21 -0800 |
commit | 8191cb181f8b5747b969776db1de29253d58ade8 (patch) | |
tree | 19ee24d0b3fbb255a2c4dc8d0e448e0e5b39d1a3 /src | |
parent | ac6c450b38b2fe4d049eef8aaa2acd56e3be9ae2 (diff) | |
download | binaryen-8191cb181f8b5747b969776db1de29253d58ade8.tar.gz binaryen-8191cb181f8b5747b969776db1de29253d58ade8.tar.bz2 binaryen-8191cb181f8b5747b969776db1de29253d58ade8.zip |
Print recursion groups in wasm-fuzz-types (#4509)
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/wasm-fuzz-types.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/wasm-fuzz-types.cpp b/src/tools/wasm-fuzz-types.cpp index 4b1f2800e..352a8a5fb 100644 --- a/src/tools/wasm-fuzz-types.cpp +++ b/src/tools/wasm-fuzz-types.cpp @@ -88,8 +88,22 @@ void Fuzzer::printTypes(const std::vector<HeapType>& types) { }; IndexedTypeNameGenerator<FatalTypeNameGenerator> print(types); std::unordered_map<HeapType, size_t> seen; + std::optional<RecGroup> currRecGroup; + auto inRecGroup = [&]() { return currRecGroup && currRecGroup->size() > 1; }; for (size_t i = 0; i < types.size(); ++i) { auto type = types[i]; + if (!type.isBasic() && type.getRecGroup() != currRecGroup) { + if (inRecGroup()) { + std::cout << ")\n"; + } + currRecGroup = type.getRecGroup(); + if (inRecGroup()) { + std::cout << "(rec\n"; + } + } + if (inRecGroup()) { + std::cout << ' '; + } std::cout << "(type $" << i << ' '; if (type.isBasic()) { std::cout << print(type) << ")\n"; @@ -103,6 +117,9 @@ void Fuzzer::printTypes(const std::vector<HeapType>& types) { } std::cout << ")\n"; } + if (inRecGroup()) { + std::cout << ")\n"; + } } void Fuzzer::checkSubtypes( |