diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-05-15 15:58:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-15 15:58:13 -0700 |
commit | d4aa0d30234ac9e553d743bd881a767d96554a4a (patch) | |
tree | fea2a16948b3d04db4c89e9c454daa2fccdf8716 /src/wasm-printing.h | |
parent | 1354d20a1765c9132958c69661d613dc62eb3216 (diff) | |
download | binaryen-d4aa0d30234ac9e553d743bd881a767d96554a4a.tar.gz binaryen-d4aa0d30234ac9e553d743bd881a767d96554a4a.tar.bz2 binaryen-d4aa0d30234ac9e553d743bd881a767d96554a4a.zip |
Clean up printing code (#1548)
* make the iostream overrides receive a reference, not a pointer (i.e., like e.g. LLVM IR printing works, and avoiding overriding printing of pointer addresses which is sort of odd)
* move more code out of headers, especially unrelated headers.
Diffstat (limited to 'src/wasm-printing.h')
-rw-r--r-- | src/wasm-printing.h | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/wasm-printing.h b/src/wasm-printing.h index 3b5b94cc2..936c118ee 100644 --- a/src/wasm-printing.h +++ b/src/wasm-printing.h @@ -25,18 +25,9 @@ namespace wasm { struct WasmPrinter { - static std::ostream& printModule(Module* module, std::ostream& o) { - PassRunner passRunner(module); - passRunner.setFeatures(Feature::All); - passRunner.setIsNested(true); - passRunner.add<Printer>(&o); - passRunner.run(); - return o; - } - - static std::ostream& printModule(Module* module) { - return printModule(module, std::cout); - } + static std::ostream& printModule(Module* module, std::ostream& o); + + static std::ostream& printModule(Module* module); static std::ostream& printExpression(Expression* expression, std::ostream& o, bool minify = false, bool full = false); }; @@ -45,12 +36,12 @@ struct WasmPrinter { namespace std { -inline std::ostream& operator<<(std::ostream& o, wasm::Module* module) { - return wasm::WasmPrinter::printModule(module, o); +inline std::ostream& operator<<(std::ostream& o, wasm::Module& module) { + return wasm::WasmPrinter::printModule(&module, o); } -inline std::ostream& operator<<(std::ostream& o, wasm::Expression* expression) { - return wasm::WasmPrinter::printExpression(expression, o); +inline std::ostream& operator<<(std::ostream& o, wasm::Expression& expression) { + return wasm::WasmPrinter::printExpression(&expression, o); } } |