1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Track LLVM 14 API changes, up to 2022-01-30.

Tested with LLVM 11, LLVM 13 and LLVM's main branch at commit
8d8fce87bbd5.  There are still some deprecation warnings that will need
to be sorted out, but this may be enough to turn "seawasp" green again.

Like commit e6a76002, done on master only for now.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA%2BhUKG%2B3Ac3He9_SpJcxeiiVknbcES1tbZEkH9sRBdJFGj8K5Q%40mail.gmail.com
This commit is contained in:
Thomas Munro
2022-02-04 16:16:10 +13:00
parent 7f481b8d38
commit 807fee1a39

View File

@ -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 char *reason,
bool gen_crash_diag)
{
ereport(FATAL,
(errcode(ERRCODE_OUT_OF_MEMORY),
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)
{
ereport(FATAL,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("fatal llvm error: %s",
reason.c_str())));
fatal_llvm_error_handler(user_data, reason.c_str(), gen_crash_diag);
}
#endif