summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-12-19 10:51:50 -0800
committerGitHub <noreply@github.com>2018-12-19 10:51:50 -0800
commitfcbcf3bd670a9ee793a836be49d825b944baf501 (patch)
tree0fc4990b401e9f29098465168bcdfb8d1b8e122f
parent44558539bf5842ac67ea845fc0e63983f77e7ffc (diff)
downloadbinaryen-fcbcf3bd670a9ee793a836be49d825b944baf501.tar.gz
binaryen-fcbcf3bd670a9ee793a836be49d825b944baf501.tar.bz2
binaryen-fcbcf3bd670a9ee793a836be49d825b944baf501.zip
Use interned Names in NoExitRuntime (#1837)
-rw-r--r--src/passes/NoExitRuntime.cpp16
1 files changed, 8 insertions, 8 deletions
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<PostWalker<NoExitRuntime>> {
Pass* create() override { return new NoExitRuntime; }
+ // Remove all possible manifestations of atexit, across asm2wasm and llvm wasm backend.
+ std::array<Name, 4> 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)
);