From 3505457946192ef2ee0beac3356d9c0ed0d22b0f Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 27 Sep 2024 10:34:48 +0900 Subject: [PATCH] GH-44222: [C++][Gandiva] Accept LLVM 19.1 (#44233) ### Rationale for this change LLVM 19.1.0 was released. ### What changes are included in this PR? Accept LLVM 19.1.0. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: #44222 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/CMakeLists.txt | 1 + cpp/src/gandiva/engine.cc | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 423744c388471..a40afd00c85a0 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -160,6 +160,7 @@ set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}") set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support") set(ARROW_LLVM_VERSIONS + "19.1" "18.1" "17.0" "16.0" diff --git a/cpp/src/gandiva/engine.cc b/cpp/src/gandiva/engine.cc index 065ea5a59837e..244e1a45bd7b6 100644 --- a/cpp/src/gandiva/engine.cc +++ b/cpp/src/gandiva/engine.cc @@ -263,9 +263,15 @@ void Engine::InitOnce() { llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr); cpu_name = llvm::sys::getHostCPUName(); +#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 std::string cpu_attrs_str; - if (llvm::sys::getHostCPUFeatures(host_features)) { + if (have_host_features) { for (auto& f : host_features) { std::string attr = f.second ? std::string("+") + f.first().str() : std::string("-") + f.first().str();