diff options
author | Alon Zakai <azakai@google.com> | 2021-05-11 16:16:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-11 16:16:53 -0700 |
commit | 4cfbb5d90bd253c066d92affa685dbab5d824699 (patch) | |
tree | f600492e4587099feb232021fd067cc128ae874a | |
parent | ed92a8d5e493c839687c2f2d56cdc5123e6e3a47 (diff) | |
download | binaryen-4cfbb5d90bd253c066d92affa685dbab5d824699.tar.gz binaryen-4cfbb5d90bd253c066d92affa685dbab5d824699.tar.bz2 binaryen-4cfbb5d90bd253c066d92affa685dbab5d824699.zip |
Printing: Add a comment when we cannot emit something (#3878)
If we can't emit something, and instead emit a replacement for it (as is
the case for a StructSet with an unreachable RTT, so we have no known
heap type for it), add a comment that mentions it is a replacement. This
might avoid confusion while debugging.
-rw-r--r-- | src/passes/Print.cpp | 3 | ||||
-rw-r--r-- | test/heap-types.wast.from-wast | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index ef78bf582..41e800352 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2351,6 +2351,9 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { // // Emit a block with drops of the children. o << "(block"; + if (!minify) { + o << " ;; (replaces something unreachable we can't emit)"; + } incIndent(); for (auto* child : ChildIterator(curr)) { Drop drop; diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast index fbbc47af9..281d1983e 100644 --- a/test/heap-types.wast.from-wast +++ b/test/heap-types.wast.from-wast @@ -309,7 +309,7 @@ ) (func $unreachables-1 (drop - (block + (block ;; (replaces something unreachable we can't emit) (drop (unreachable) ) @@ -323,7 +323,7 @@ ) ) (func $unreachables-3 - (block + (block ;; (replaces something unreachable we can't emit) (drop (unreachable) ) @@ -333,7 +333,7 @@ ) ) (func $unreachables-4 - (block + (block ;; (replaces something unreachable we can't emit) (drop (unreachable) ) |