diff options
Diffstat (limited to 'src/ir/eh-utils.h')
-rw-r--r-- | src/ir/eh-utils.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ir/eh-utils.h b/src/ir/eh-utils.h index 25677a32e..79ccbc507 100644 --- a/src/ir/eh-utils.h +++ b/src/ir/eh-utils.h @@ -17,6 +17,7 @@ #ifndef wasm_ir_eh_h #define wasm_ir_eh_h +#include "support/small_vector.h" #include "wasm.h" namespace wasm { @@ -40,6 +41,25 @@ void handleBlockNestedPop(Try* try_, Function* func, Module& wasm); // Calls handleBlockNestedPop for each 'Try's in a given function. void handleBlockNestedPops(Function* func, Module& wasm); +// Given a catch body, find the pop corresponding to the catch. There might be +// pops nested inside a try inside this catch, and we must ignore them, like +// here: +// +// (catch +// (pop) ;; we want this for the outer catch +// (try +// (catch +// (pop) ;; but we do not want this for the outer catch +// +// If there is no pop, which can happen if the tag has no params, then nullptr +// is returned. +Pop* findPop(Expression* expr); + +// Like findPop(), but it does *not* assume that the module validates. A catch +// might therefore have any number of pops. This function is primarily useful in +// the validator - normally you should call findPop(), above. +SmallVector<Pop*, 1> findPops(Expression* expr); + } // namespace EHUtils } // namespace wasm |