From 2257f857069faa56335d2e24d7d6853c9501fcb7 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 17 Dec 2020 12:39:21 -0800 Subject: Refactor printing code so that printing Expressions always works (#3450) This avoids needing to add include wasm-printing if a file doesn't already have it. To achieve that, add the std::ostream hooks in wasm.h, and also use them when possible, removing the need for the special WasmPrinter object. Also stop printing in "full" (print types on each line) in error messages by default. The user can still get that, as always, using BINARYEN_PRINT_FULL=1 in the env. --- test/example/module-splitting.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test/example/module-splitting.cpp') diff --git a/test/example/module-splitting.cpp b/test/example/module-splitting.cpp index bba0bf0a7..ad0da84a8 100644 --- a/test/example/module-splitting.cpp +++ b/test/example/module-splitting.cpp @@ -4,7 +4,6 @@ #include "ir/module-splitting.h" #include "ir/stack-utils.h" #include "wasm-features.h" -#include "wasm-printing.h" #include "wasm-s-parser.h" #include "wasm-validator.h" #include "wasm.h" @@ -34,7 +33,7 @@ void do_test(const std::set& keptFuncs, std::string&& module) { assert(valid && "before invalid!"); std::cout << "Before:\n"; - WasmPrinter::printModule(primary.get()); + std::cout << *primary.get(); std::cout << "Keeping: "; if (keptFuncs.size()) { @@ -54,9 +53,9 @@ void do_test(const std::set& keptFuncs, std::string&& module) { auto secondary = splitFunctions(*primary, config); std::cout << "After:\n"; - WasmPrinter::printModule(primary.get()); + std::cout << *primary.get(); std::cout << "Secondary:\n"; - WasmPrinter::printModule(secondary.get()); + std::cout << *secondary.get(); std::cout << "\n\n"; valid = validator.validate(*primary); -- cgit v1.2.3