diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp index d4d41520666..e2b518104d1 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp @@ -465,15 +465,19 @@ ManagedStatic<RuntimeLibcallSignatureTable> RuntimeLibcallSignatures; struct StaticLibcallNameMap { StringMap<RTLIB::Libcall> Map; StaticLibcallNameMap() { -#define HANDLE_LIBCALL(code, name) \ - if ((const char *)name && \ - RuntimeLibcallSignatures->Table[RTLIB::code] != unsupported) { \ - assert(Map.find(StringRef::withNullAsEmpty(name)) == Map.end() && \ - "duplicate libcall names in name map"); \ - Map[StringRef::withNullAsEmpty(name)] = RTLIB::code; \ - } + static constexpr std::pair<const char *, RTLIB::Libcall> NameLibcalls[] = { +#define HANDLE_LIBCALL(code, name) {(const char *)name, RTLIB::code}, #include "llvm/CodeGen/RuntimeLibcalls.def" #undef HANDLE_LIBCALL + }; + for (const auto &NameLibcall : NameLibcalls) { + if (NameLibcall.first != nullptr && + RuntimeLibcallSignatures->Table[NameLibcall.second] != unsupported) { + assert(Map.find(NameLibcall.first) == Map.end() && + "duplicate libcall names in name map"); + Map[NameLibcall.first] = NameLibcall.second; + } + } } }; |