diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-02-17 14:37:06 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-02-17 14:50:00 -0800 |
commit | 51a0ffcc0a6bdd205e3979cc147adcf0e1186af4 (patch) | |
tree | 6d7e11b355c6f417ed567d0c9349d0cee25f7e3c /test | |
parent | dbb5f32bafcf3c8f51eefb95e6c298ce6b9ac8cc (diff) | |
download | binaryen-51a0ffcc0a6bdd205e3979cc147adcf0e1186af4.tar.gz binaryen-51a0ffcc0a6bdd205e3979cc147adcf0e1186af4.tar.bz2 binaryen-51a0ffcc0a6bdd205e3979cc147adcf0e1186af4.zip |
add wasm-printing.h
Diffstat (limited to 'test')
-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"; } } } |