summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-07-20 15:39:51 -0700
committerGitHub <noreply@github.com>2023-07-20 15:39:51 -0700
commit0d79590340237214bccfca6a73ad11b3728f26fc (patch)
tree330e7f5bdf6c4c05a7cf8ba0aba2f6ec3a973976 /src
parent01f5eb8cf7d280e12985e628041ba57f9f8402d1 (diff)
downloadbinaryen-0d79590340237214bccfca6a73ad11b3728f26fc.tar.gz
binaryen-0d79590340237214bccfca6a73ad11b3728f26fc.tar.bz2
binaryen-0d79590340237214bccfca6a73ad11b3728f26fc.zip
Add support for debug printing of functions (#5828)
Diffstat (limited to 'src')
-rw-r--r--src/passes/Print.cpp8
-rw-r--r--src/wasm.h1
2 files changed, 9 insertions, 0 deletions
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<wasm::Address> {
};
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);