diff options
author | Thomas Munro <tmunro@postgresql.org> | 2022-03-16 11:35:00 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2022-03-16 11:40:43 +1300 |
commit | 45a469eb2dcce811c5259054c4a03d84f1ad07eb (patch) | |
tree | b0a276ee49e51340601790decfd419e73230eb65 /src/backend/jit/llvm/llvmjit_error.cpp | |
parent | 2cd7d8d53079cd74f0151465be316a94993d1218 (diff) | |
download | postgresql-45a469eb2dcce811c5259054c4a03d84f1ad07eb.tar.gz postgresql-45a469eb2dcce811c5259054c4a03d84f1ad07eb.zip |
Back-patch LLVM 14 API changes.
Since LLVM 14 has stopped changing and is about to be released,
back-patch the following changes from the master branch:
e6a7600202105919bffd62b3dfd941f4a94e082b
807fee1a39de6bb8184082012e643951abb9ad1d
a56e7b66010f330782243de9e25ac2a6596be0e1
Back-patch to 11, where LLVM JIT support came in.
Diffstat (limited to 'src/backend/jit/llvm/llvmjit_error.cpp')
-rw-r--r-- | src/backend/jit/llvm/llvmjit_error.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/backend/jit/llvm/llvmjit_error.cpp b/src/backend/jit/llvm/llvmjit_error.cpp index adfca4a7081..e6143fcf0d1 100644 --- a/src/backend/jit/llvm/llvmjit_error.cpp +++ b/src/backend/jit/llvm/llvmjit_error.cpp @@ -23,15 +23,22 @@ extern "C" #include "jit/llvmjit.h" +#include <new> static int fatal_new_handler_depth = 0; static std::new_handler old_new_handler = NULL; static void fatal_system_new_handler(void); #if LLVM_VERSION_MAJOR > 4 +static void fatal_llvm_new_handler(void *user_data, const char *reason, bool gen_crash_diag); +#if LLVM_VERSION_MAJOR < 14 static void fatal_llvm_new_handler(void *user_data, const std::string& reason, bool gen_crash_diag); #endif +#endif +static void fatal_llvm_error_handler(void *user_data, const char *reason, bool gen_crash_diag); +#if LLVM_VERSION_MAJOR < 14 static void fatal_llvm_error_handler(void *user_data, const std::string& reason, bool gen_crash_diag); +#endif /* @@ -129,23 +136,41 @@ fatal_system_new_handler(void) #if LLVM_VERSION_MAJOR > 4 static void fatal_llvm_new_handler(void *user_data, - const std::string& reason, + const char *reason, bool gen_crash_diag) { ereport(FATAL, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"), - errdetail("While in LLVM: %s", reason.c_str()))); + errdetail("While in LLVM: %s", reason))); +} +#if LLVM_VERSION_MAJOR < 14 +static void +fatal_llvm_new_handler(void *user_data, + const std::string& reason, + bool gen_crash_diag) +{ + fatal_llvm_new_handler(user_data, reason.c_str(), gen_crash_diag); } #endif +#endif static void fatal_llvm_error_handler(void *user_data, - const std::string& reason, + const char *reason, bool gen_crash_diag) { ereport(FATAL, (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("fatal llvm error: %s", - reason.c_str()))); + errmsg("fatal llvm error: %s", reason))); } + +#if LLVM_VERSION_MAJOR < 14 +static void +fatal_llvm_error_handler(void *user_data, + const std::string& reason, + bool gen_crash_diag) +{ + fatal_llvm_error_handler(user_data, reason.c_str(), gen_crash_diag); +} +#endif |