From 150d723054b377ad3c15d27f235daf60aa9aa98b Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Thu, 2 Jan 2025 10:16:45 -0800 Subject: [PATCH] Add support for llvm 19 to original (reverted-to) code. --- cpp/src/gandiva/engine.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cpp/src/gandiva/engine.cc b/cpp/src/gandiva/engine.cc index c7ef2a7f4f70f..b6f3f43422ab0 100644 --- a/cpp/src/gandiva/engine.cc +++ b/cpp/src/gandiva/engine.cc @@ -251,7 +251,14 @@ static void SetDataLayout(llvm::Module* module) { llvm::SubtargetFeatures features; llvm::StringMap host_features; - if (llvm::sys::getHostCPUFeatures(host_features)) { +#if LLVM_VERSION_MAJOR >= 19 + auto host_features = llvm::sys::getHostCPUFeatures(); + const bool have_host_features = true; +#else + llvm::StringMap host_features; + const auto have_host_features = llvm::sys::getHostCPUFeatures(host_features); +#endif + if (have_host_features) { for (auto& f : host_features) { features.AddFeature(f.first(), f.second); }