Skip to content

Commit a86eeb8

Browse files
DX-105463: Fix LLVM version-specific Optional type and deprecated getPointerTo() API
1 parent d086f75 commit a86eeb8

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

cpp/src/gandiva/engine.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ Result<std::unique_ptr<llvm::orc::LLJIT>> BuildJIT(
229229
#endif
230230

231231
jit_builder.setJITTargetMachineBuilder(std::move(jtmb));
232+
#if LLVM_VERSION_MAJOR >= 17
233+
jit_builder.setDataLayout(std::make_optional(data_layout));
234+
#else
232235
jit_builder.setDataLayout(llvm::Optional<llvm::DataLayout>(data_layout));
236+
#endif
233237

234238
if (object_cache.has_value()) {
235239
jit_builder.setCompileFunctionCreator(

cpp/src/gandiva/timestamp_ir.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ Status TimestampIR::BuildTimezoneWrapper(const std::string& function_name,
430430

431431
auto i64 = types()->i64_type();
432432
auto i32 = types()->i32_type();
433-
auto i8ptr = llvm::Type::getInt8Ty(*context())->getPointerTo();
433+
auto i8ptr = types()->i8_ptr_type();
434434
auto function = BuildFunction(
435435
function_name, i64, {{"ctx", i64}, {"ts", i64}, {"tz", i8ptr}, {"tz_len", i32}});
436436
auto entry = llvm::BasicBlock::Create(*context(), "entry", function);
@@ -468,9 +468,9 @@ Status TimestampIR::BuildCastVARCHARWrapper(const std::string& function_name,
468468

469469
auto i64 = types()->i64_type();
470470
auto i32 = types()->i32_type();
471-
auto i8 = llvm::Type::getInt8Ty(*context());
472-
auto i8ptr = i8->getPointerTo();
473-
auto i32ptr = i32->getPointerTo();
471+
auto i8 = types()->i8_type();
472+
auto i8ptr = types()->i8_ptr_type();
473+
auto i32ptr = types()->i32_ptr_type();
474474
auto function =
475475
BuildFunction(function_name, i8ptr,
476476
{{"ctx", i64}, {"ts", i64}, {"len", i64}, {"out_len", i32ptr}});

0 commit comments

Comments
 (0)