From 0d79590340237214bccfca6a73ad11b3728f26fc Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 20 Jul 2023 15:39:51 -0700 Subject: Add support for debug printing of functions (#5828) --- src/passes/Print.cpp | 8 ++++++++ src/wasm.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 67d0dbdcc..e9facd5a9 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -3763,6 +3763,14 @@ std::ostream& operator<<(std::ostream& o, wasm::Module& module) { return o; } +std::ostream& operator<<(std::ostream& o, wasm::Function& func) { + wasm::PrintSExpression print(o); + print.setMinify(false); + print.setDebugInfo(false); + print.visitFunction(&func); + return o; +} + std::ostream& operator<<(std::ostream& o, wasm::Expression& expression) { return wasm::printExpression(&expression, o); } diff --git a/src/wasm.h b/src/wasm.h index afb824bdd..c059009b6 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -2330,6 +2330,7 @@ template<> struct hash { }; std::ostream& operator<<(std::ostream& o, wasm::Module& module); +std::ostream& operator<<(std::ostream& o, wasm::Function& func); std::ostream& operator<<(std::ostream& o, wasm::Expression& expression); std::ostream& operator<<(std::ostream& o, wasm::ModuleExpression pair); std::ostream& operator<<(std::ostream& o, wasm::ShallowExpression expression); -- cgit v1.2.3