Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add llvm 18 support #202

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 86 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ jobs:
fail-fast: false
matrix:
include:
- name: ubu22-x86-gcc12-clang-repl-18-cppyy
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '18'
cling: Off
cppyy: On
coverage: true
- name: ubu22-x86-gcc12-clang-repl-18-xeus-clang-repl
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '18'
cling: Off
cppyy: On
xeus-clang-repl: On
coverage: true
- name: ubu22-x86-gcc12-clang-repl-17-cppyy
os: ubuntu-22.04
compiler: gcc-12
Expand Down Expand Up @@ -70,6 +85,19 @@ jobs:
coverage: true
#Commented out until Ubuntu on arm Github runner becomes available
#os key to be replaced once known
#- name: ubu22-arm-gcc12-clang-repl-18-cppyy
# os: ubuntu-22.04-arm
# compiler: gcc-12
# clang-runtime: '18'
# cling: Off
# cppyy: On
#- name: ubu22-arm-gcc12-clang-repl-18-xeus-clang-repl
# os: ubuntu-22.04-arm
# compiler: gcc-12
# clang-runtime: '18'
# cling: Off
# cppyy: On
# xeus-clang-repl: On
#- name: ubu22-arm-gcc12-clang-repl-17-cppyy
# os: ubuntu-22.04-arm
# compiler: gcc-12
Expand Down Expand Up @@ -114,6 +142,12 @@ jobs:
# xeus-clang-repl: On
#FIXME: Windows CppInterOp tests expected to fail
#until https://github.com/compiler-research/CppInterOp/issues/188 is solved
- name: win2022-msvc-clang-repl-18
os: windows-2022
compiler: msvc
clang-runtime: '18'
cling: Off
cppyy: Off
- name: win2022-msvc-clang-repl-17
os: windows-2022
compiler: msvc
Expand Down Expand Up @@ -152,6 +186,19 @@ jobs:
# cling: On
# cling-version: '1.0'
# cppyy: On
- name: osx14-arm-clang-clang-repl-18-cppyy
os: macos-14
compiler: clang
clang-runtime: '18'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-18-xeus-clang-repl
os: macos-14
compiler: clang
clang-runtime: '18'
cling: Off
cppyy: On
xeus-clang-repl: On
- name: osx14-arm-clang-clang-repl-17-cppyy
os: macos-14
compiler: clang
Expand Down Expand Up @@ -193,6 +240,19 @@ jobs:
cling-version: '1.0'
cppyy: On
xeus-clang-repl: On
- name: osx13-x86-clang-clang-repl-18-cppyy
os: macos-13
compiler: clang
clang-runtime: '18'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang-repl-18-xeus-clang-repl
os: macos-13
compiler: clang
clang-runtime: '18'
cling: Off
cppyy: On
xeus-clang-repl: On
- name: osx13-x86-clang-clang-repl-17-cppyy
os: macos-13
compiler: clang
Expand Down Expand Up @@ -454,8 +514,11 @@ jobs:
cmake --build . --target gtest_main --parallel ${{ env.ncpus }}
else
# Apply patches
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
if [[ "${llvm_vers}" != "18" ]]; then
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
fi
cd build
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" \
Expand Down Expand Up @@ -526,7 +589,7 @@ jobs:
git apply -v clang16-2-CUDA.patch
git apply -v clang16-3-WeakRef.patch
}
elseif ( "${{ matrix.clang-runtime }}" -imatch "16" )
elseif ( "${{ matrix.clang-runtime }}" -imatch "17" )
{
git apply -v clang17-1-NewOperator.patch
}
Expand Down Expand Up @@ -920,6 +983,11 @@ jobs:
fail-fast: false
matrix:
include:
- name: ubu22-x86-gcc12-clang-repl-18-emscripten_wasm
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '18'
cling: Off
- name: ubu22-x86-gcc12-clang-repl-17-emscripten_wasm
os: ubuntu-22.04
compiler: gcc-12
Expand All @@ -936,6 +1004,11 @@ jobs:
clang-runtime: '13'
cling: On
cling-version: '1.0'
- name: osx14-arm-clang-clang-repl-18-emscripten_wasm
os: macos-14
compiler: clang
clang-runtime: '18'
cling: Off
- name: osx14-arm-clang-clang-repl-17-emscripten_wasm
os: macos-14
compiler: clang
Expand All @@ -952,6 +1025,11 @@ jobs:
clang-runtime: '13'
cling: On
cling-version: '1.0'
- name: osx13-x86-clang-clang-repl-18-emscripten_wasm
os: macos-13
compiler: clang
clang-runtime: '18'
cling: Off
- name: osx13-x86-clang-clang-repl-17-emscripten_wasm
os: macos-13
compiler: clang
Expand Down Expand Up @@ -1081,8 +1159,11 @@ jobs:
cmake --build . --target gtest_main --parallel ${{ env.ncpus }}
else
# Apply patches
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
if [[ "${llvm_vers}" != "18" ]]; then
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
fi
cd build
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" \
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
## Define supported version of clang and llvm

set(CLANG_MIN_SUPPORTED 13.0)
set(CLANG_MAX_SUPPORTED "17.0.x")
set(CLANG_VERSION_UPPER_BOUND 17.1.0)
set(CLANG_MAX_SUPPORTED "18.1.x")
set(CLANG_VERSION_UPPER_BOUND 19.0.0)
set(LLVM_MIN_SUPPORTED 13.0)
set(LLVM_MAX_SUPPORTED "17.0.x")
set(LLVM_VERSION_UPPER_BOUND 17.1.0)
set(LLVM_MAX_SUPPORTED "18.1.x")
set(LLVM_VERSION_UPPER_BOUND 19.0.0)

## Set Cmake packages search order

Expand Down
8 changes: 5 additions & 3 deletions lib/Interpreter/DynamicLibraryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ namespace Cpp {
for (const std::string& P : SysPaths)
addSearchPath(P, /*IsUser*/ false);
}

#if LLVM_VERSION_MAJOR < 18
#define starts_with_insensitive startswith_insensitive
#endif
///\returns substitution of pattern in the front of original with replacement
/// Example: substFront("@rpath/abc", "@rpath/", "/tmp") -> "/tmp/abc"
static std::string substFront(StringRef original, StringRef pattern,
StringRef replacement) {
if (!original.startswith_insensitive(pattern))
if (!original.starts_with_insensitive(pattern))
return original.str();
SmallString<512> result(replacement);
result.append(original.drop_front(pattern.size()));
Expand Down Expand Up @@ -300,7 +302,7 @@ namespace Cpp {
// Subst all known linker variables ($origin, @rpath, etc.)
#ifdef __APPLE__
// On MacOS @rpath is preplaced by all paths in RPATH one by one.
if (libStem.startswith_insensitive("@rpath")) {
if (libStem.starts_with_insensitive("@rpath")) {
for (auto& P : RPath) {
std::string result = substFront(libStem, "@rpath", P);
if (isSharedLibrary(result))
Expand Down
Loading