From ff211a9508bfd8909d464316ed02e70b9f3682a4 Mon Sep 17 00:00:00 2001 From: Eladash Date: Mon, 1 Mar 2021 15:11:01 +0200 Subject: [PATCH] LLVM: Do not crash on failure to create cache file --- Utilities/JIT.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Utilities/JIT.cpp b/Utilities/JIT.cpp index 221aa2359b..5727afa8c1 100644 --- a/Utilities/JIT.cpp +++ b/Utilities/JIT.cpp @@ -565,7 +565,12 @@ public: } } - fs::file(name, fs::rewrite).write(zbuf.get(), zsz - zs.avail_out); + if (!fs::write_file(name, fs::rewrite, zbuf.get(), zsz - zs.avail_out)) + { + jit_log.error("LLVM: Failed to create module file: %s (%s)", name, fs::g_tls_error); + return; + } + jit_log.notice("LLVM: Created module: %s", _module->getName().data()); }