diff options
Diffstat (limited to 'test/example/find_div0s.cpp')
-rw-r--r-- | test/example/find_div0s.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/example/find_div0s.cpp b/test/example/find_div0s.cpp index cb29043a7..e74d4781f 100644 --- a/test/example/find_div0s.cpp +++ b/test/example/find_div0s.cpp @@ -8,6 +8,7 @@ #include <ostream> #include <wasm.h> +#include <wasm-printing.h> #include <wasm-s-parser.h> using namespace wasm; @@ -34,7 +35,7 @@ int main() { SExpressionWasmBuilder builder(module, *root[0], [&]() { abort(); }); // Print it out - std::cout << module; + printWasm(&module, std::cout); // Search it for divisions by zero: Walk the module, looking for // that operation. @@ -45,7 +46,8 @@ int main() { // Check if the right operand is a constant, and if it is 0 auto right = curr->right->dyn_cast<Const>(); if (right && right->value.getInteger() == 0) { - std::cout << "We found that " << curr->left << " is divided by zero\n"; + std::cout << "We found that "; + printWasm(curr->left, std::cout) << " is divided by zero\n"; } } } |