Skip to content

Commit 807fee1

Browse files
committed
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 e6a7600, 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
1 parent 7f481b8 commit 807fee1

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

src/backend/jit/llvm/llvmjit_error.cpp

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,22 @@ extern "C"
2323

2424
#include "jit/llvmjit.h"
2525

26+
#include <new>
2627

2728
static int fatal_new_handler_depth = 0;
2829
static std::new_handler old_new_handler = NULL;
2930

3031
static void fatal_system_new_handler(void);
3132
#if LLVM_VERSION_MAJOR > 4
33+
static void fatal_llvm_new_handler(void *user_data, const char *reason, bool gen_crash_diag);
34+
#if LLVM_VERSION_MAJOR < 14
3235
static void fatal_llvm_new_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
3336
#endif
37+
#endif
38+
static void fatal_llvm_error_handler(void *user_data, const char *reason, bool gen_crash_diag);
39+
#if LLVM_VERSION_MAJOR < 14
3440
static void fatal_llvm_error_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
41+
#endif
3542

3643

3744
/*
@@ -129,23 +136,41 @@ fatal_system_new_handler(void)
129136
#if LLVM_VERSION_MAJOR > 4
130137
static void
131138
fatal_llvm_new_handler(void *user_data,
132-
const std::string& reason,
139+
const char *reason,
133140
bool gen_crash_diag)
134141
{
135142
ereport(FATAL,
136143
(errcode(ERRCODE_OUT_OF_MEMORY),
137144
errmsg("out of memory"),
138-
errdetail("While in LLVM: %s", reason.c_str())));
145+
errdetail("While in LLVM: %s", reason)));
146+
}
147+
#if LLVM_VERSION_MAJOR < 14
148+
static void
149+
fatal_llvm_new_handler(void *user_data,
150+
const std::string& reason,
151+
bool gen_crash_diag)
152+
{
153+
fatal_llvm_new_handler(user_data, reason.c_str(), gen_crash_diag);
139154
}
140155
#endif
156+
#endif
141157

142158
static void
143159
fatal_llvm_error_handler(void *user_data,
144-
const std::string& reason,
160+
const char *reason,
145161
bool gen_crash_diag)
146162
{
147163
ereport(FATAL,
148164
(errcode(ERRCODE_OUT_OF_MEMORY),
149-
errmsg("fatal llvm error: %s",
150-
reason.c_str())));
165+
errmsg("fatal llvm error: %s", reason)));
151166
}
167+
168+
#if LLVM_VERSION_MAJOR < 14
169+
static void
170+
fatal_llvm_error_handler(void *user_data,
171+
const std::string& reason,
172+
bool gen_crash_diag)
173+
{
174+
fatal_llvm_error_handler(user_data, reason.c_str(), gen_crash_diag);
175+
}
176+
#endif

0 commit comments

Comments
 (0)