Skip to content

Commit fcbcf3b

Browse files
authored
Use interned Names in NoExitRuntime (#1837)
1 parent 4455853 commit fcbcf3b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/passes/NoExitRuntime.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ struct NoExitRuntime : public WalkerPass<PostWalker<NoExitRuntime>> {
3434

3535
Pass* create() override { return new NoExitRuntime; }
3636

37+
// Remove all possible manifestations of atexit, across asm2wasm and llvm wasm backend.
38+
std::array<Name, 4> ATEXIT_NAMES = {{ "___cxa_atexit",
39+
"__cxa_atexit",
40+
"_atexit",
41+
"atexit" }};
42+
3743
void visitCall(Call* curr) {
3844
auto* import = getModule()->getFunctionOrNull(curr->target);
3945
if (!import || !import->imported() || import->module != ENV) return;
40-
// Remove all possible manifestations of atexit, across asm2wasm and llvm wasm backend.
41-
for (auto* name : {
42-
"___cxa_atexit",
43-
"_atexit",
44-
"__cxa_atexit",
45-
"atexit",
46-
}) {
47-
if (strcmp(name, import->base.str) == 0) {
46+
for (auto name : ATEXIT_NAMES) {
47+
if (name == import->base) {
4848
replaceCurrent(
4949
Builder(*getModule()).replaceWithIdenticalType(curr)
5050
);

0 commit comments

Comments
 (0)