diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-11-06 16:48:38 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-11-06 16:48:38 -0800 |
commit | 962c9a63f854f888e4f0fc48f217beefccce4266 (patch) | |
tree | 95b43193e4cccbd6b65a7f9fc0ab4978d6671987 /src | |
parent | 033b5e161e677173bda01aad9e6850545b93c97e (diff) | |
download | binaryen-962c9a63f854f888e4f0fc48f217beefccce4266.tar.gz binaryen-962c9a63f854f888e4f0fc48f217beefccce4266.tar.bz2 binaryen-962c9a63f854f888e4f0fc48f217beefccce4266.zip |
make ExtractFunction use an env var instead of a hardcoded string
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/ExtractFunction.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/passes/ExtractFunction.cpp b/src/passes/ExtractFunction.cpp index b342efc3b..b91d2c406 100644 --- a/src/passes/ExtractFunction.cpp +++ b/src/passes/ExtractFunction.cpp @@ -23,12 +23,18 @@ namespace wasm { -Name TO_LEAVE("_bytearray_join"); // TODO: commandline param struct ExtractFunction : public Pass { void run(PassRunner* runner, Module* module) override { + auto* leave = getenv("BYN_LEAVE"); + if (!leave) { + std::cerr << "usage: set BYN_LEAVE in the env\n"; + abort(); + } + Name LEAVE(leave); + std::cerr << "keeping " << LEAVE << "\n"; for (auto& func : module->functions) { - if (func->name != TO_LEAVE) { + if (func->name != LEAVE) { // wipe out the body func->body = module->allocator.alloc<Unreachable>(); } |