From fcbcf3bd670a9ee793a836be49d825b944baf501 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 19 Dec 2018 10:51:50 -0800 Subject: Use interned Names in NoExitRuntime (#1837) --- src/passes/NoExitRuntime.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/passes/NoExitRuntime.cpp b/src/passes/NoExitRuntime.cpp index d76bb34ba..05dd639c9 100644 --- a/src/passes/NoExitRuntime.cpp +++ b/src/passes/NoExitRuntime.cpp @@ -34,17 +34,17 @@ struct NoExitRuntime : public WalkerPass> { Pass* create() override { return new NoExitRuntime; } + // Remove all possible manifestations of atexit, across asm2wasm and llvm wasm backend. + std::array ATEXIT_NAMES = {{ "___cxa_atexit", + "__cxa_atexit", + "_atexit", + "atexit" }}; + void visitCall(Call* curr) { auto* import = getModule()->getFunctionOrNull(curr->target); if (!import || !import->imported() || import->module != ENV) return; - // Remove all possible manifestations of atexit, across asm2wasm and llvm wasm backend. - for (auto* name : { - "___cxa_atexit", - "_atexit", - "__cxa_atexit", - "atexit", - }) { - if (strcmp(name, import->base.str) == 0) { + for (auto name : ATEXIT_NAMES) { + if (name == import->base) { replaceCurrent( Builder(*getModule()).replaceWithIdenticalType(curr) ); -- cgit v1.2.3