[PATCH] D60232: [WebAssembly] EmscriptenEHSjLj: Don't abort if __THREW__ is defined
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 14:17:29 PDT 2019
sbc100 updated this revision to Diff 193596.
sbc100 added a comment.
- feedback
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60232/new/
https://reviews.llvm.org/D60232
Files:
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
Index: llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -334,11 +334,12 @@
// which will generate an import and asssumes that it will exist at link time.
static GlobalVariable *getGlobalVariableI32(Module &M, IRBuilder<> &IRB,
const char *Name) {
- if (M.getNamedGlobal(Name))
- report_fatal_error(Twine("variable name is reserved: ") + Name);
- return new GlobalVariable(M, IRB.getInt32Ty(), false,
- GlobalValue::ExternalLinkage, nullptr, Name);
+ auto* GV = dyn_cast<GlobalVariable>(M.getOrInsertGlobal(Name, IRB.getInt32Ty()));
+ if (!GV)
+ report_fatal_error(Twine("unable to create global: ") + Name);
+
+ return GV;
}
// Simple function name mangler.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60232.193596.patch
Type: text/x-patch
Size: 974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190403/0e268a7f/attachment.bin>
More information about the llvm-commits
mailing list