Skip to content
Open
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
59 changes: 58 additions & 1 deletion .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,34 @@ jobs:
llvm_enable_projects: "clang;lld"
llvm_targets_to_build: "WebAssembly"
emsdk_ver: "3.1.73"
- name: ubu24-arm-clang-repl-21-emscripten
os: ubuntu-24.04-arm
clang-runtime: '21'
cling: Off
llvm_enable_projects: "clang;lld"
llvm_targets_to_build: "WebAssembly"
emsdk_ver: "3.1.73"
- name: osx15-arm-clang-repl-21-emscripten
os: macos-15
clang-runtime: '21'
cling: Off
llvm_enable_projects: "clang;lld"
llvm_targets_to_build: "WebAssembly"
emsdk_ver: "3.1.73"
- name: ubu24-x86-clang-repl-21-emscripten
os: ubuntu-24.04
clang-runtime: '21'
cling: Off
llvm_enable_projects: "clang;lld"
llvm_targets_to_build: "WebAssembly"
emsdk_ver: "3.1.73"
- name: win2025-x86-clang-repl-21-emscripten
os: windows-2025
clang-runtime: '21'
cling: Off
llvm_enable_projects: "clang;lld"
llvm_targets_to_build: "WebAssembly"
emsdk_ver: "3.1.73"

steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -199,7 +227,7 @@ jobs:
else
# Apply patches
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
if [[ "${llvm_vers}" == "19" || "${llvm_vers}" == "20" ]]; then
if [[ "${llvm_vers}" == "19" || "${llvm_vers}" == "20" || "${llvm_vers}" == "21" ]]; then
git apply -v ../patches/llvm/emscripten-clang${{ matrix.clang-runtime }}-*.patch
echo "Apply emscripten-clang${{ matrix.clang-runtime }}-*.patch patches:"
fi
Expand Down Expand Up @@ -325,6 +353,11 @@ jobs:
git apply -v emscripten-clang20-2-shift-temporary-files-to-tmp-dir.patch
git apply -v emscripten-clang20-3-enable_exception_handling.patch
}
elseif ( "${{ matrix.clang-runtime }}" -imatch "21" )
{
git apply -v emscripten-clang21-1-shift-temporary-files-to-tmp-dir.patch
git apply -v emscripten-clang21-2-enable_exception_handling.patch
}
cd build
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
emcmake cmake -DCMAKE_BUILD_TYPE=Release `
Expand Down Expand Up @@ -437,6 +470,30 @@ jobs:
cling: Off
micromamba_shell_init: powershell
emsdk_ver: "3.1.73"
- name: ubu24-x86-clang-repl-21-emscripten_wasm
os: ubuntu-24.04
clang-runtime: '21'
cling: Off
micromamba_shell_init: bash
emsdk_ver: "3.1.73"
- name: osx15-arm-clang-repl-21-emscripten_wasm
os: macos-15
clang-runtime: '21'
cling: Off
micromamba_shell_init: bash
emsdk_ver: "3.1.73"
- name: ubu24-arm-clang-repl-21-emscripten_wasm
os: ubuntu-24.04-arm
clang-runtime: '21'
cling: Off
micromamba_shell_init: bash
emsdk_ver: "3.1.73"
- name: win2025-x86-clang-repl-21-emscripten
os: windows-2025
clang-runtime: '21'
cling: Off
micromamba_shell_init: powershell
emsdk_ver: "3.1.73"

steps:
- uses: actions/checkout@v5
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ jobs:
matrix:
include:
# Ubuntu Arm Jobs
- name: ubu24-arm-gcc12-clang-repl-21
os: ubuntu-24.04-arm
compiler: gcc-12
clang-runtime: '21'
cling: Off
cppyy: Off
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
- name: ubu22-arm-gcc12-clang-repl-20-coverage
os: ubuntu-22.04-arm
compiler: gcc-12
Expand Down Expand Up @@ -66,6 +74,14 @@ jobs:
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
# Ubuntu X86 Jobs
- name: ubu24-x86-gcc12-clang-repl-21
os: ubuntu-24.04
compiler: gcc-12
clang-runtime: '21'
cling: Off
cppyy: Off
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
- name: ubu24-x86-gcc12-clang-repl-20
os: ubuntu-24.04
compiler: gcc-12
Expand Down Expand Up @@ -100,6 +116,14 @@ jobs:
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
# MacOS Arm Jobs
- name: osx15-arm-clang-clang-repl-21
os: macos-15
compiler: clang
clang-runtime: '21'
cling: Off
cppyy: Off
llvm_enable_projects: "clang"
llvm_targets_to_build: "host"
- name: osx15-arm-clang-clang-repl-20
os: macos-15
compiler: clang
Expand Down Expand Up @@ -134,6 +158,14 @@ jobs:
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
# MacOS X86 Jobs
- name: osx13-x86-clang-clang-repl-21
os: macos-13
compiler: clang
clang-runtime: '21'
cling: Off
cppyy: Off
llvm_enable_projects: "clang"
llvm_targets_to_build: "host"
- name: osx13-x86-clang-clang-repl-20
os: macos-13
compiler: clang
Expand Down Expand Up @@ -168,6 +200,13 @@ jobs:
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
# Windows Arm Jobs
- name: win11-msvc-clang-repl-21
os: windows-11-arm
compiler: msvc
clang-runtime: '21'
cling: Off
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
- name: win11-msvc-clang-repl-20
os: windows-11-arm
compiler: msvc
Expand All @@ -184,6 +223,13 @@ jobs:
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
# Windows X86 Jobs
- name: win2025-msvc-clang-repl-21
os: windows-2025
compiler: msvc
clang-runtime: '21'
cling: Off
llvm_enable_projects: "clang"
llvm_targets_to_build: "host;NVPTX"
- name: win2025-msvc-clang-repl-20
os: windows-2025
compiler: msvc
Expand Down
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ include(GNUInstallDirs)
## Define supported version of clang and llvm

set(CLANG_MIN_SUPPORTED 18.0)
set(CLANG_MAX_SUPPORTED "20.1.x")
set(CLANG_VERSION_UPPER_BOUND 21.0.0)
set(CLANG_MAX_SUPPORTED "21.1.x")
set(CLANG_VERSION_UPPER_BOUND 22.0.0)
set(LLD_MIN_SUPPORTED 18.0)
set(LLD_MAX_SUPPORTED "20.1.x")
set(LLD_VERSION_UPPER_BOUND 21.0.0)
set(LLD_MAX_SUPPORTED "21.1.x")
set(LLD_VERSION_UPPER_BOUND 22.0.0)
set(LLVM_MIN_SUPPORTED 18.0)
set(LLVM_MAX_SUPPORTED "20.1.x")
set(LLVM_VERSION_UPPER_BOUND 21.0.0)
set(LLVM_MAX_SUPPORTED "21.1.x")
set(LLVM_VERSION_UPPER_BOUND 22.0.0)

## Set Cmake packages search order

Expand Down
14 changes: 7 additions & 7 deletions Emscripten-build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ $env:PWD_DIR= $PWD.Path
$env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot"
```

Now clone the 20.x release of the LLVM project repository and CppInterOp (the building of the emscripten version of llvm can be
Now clone the 21.x release of the LLVM project repository and CppInterOp (the building of the emscripten version of llvm can be
avoided by executing micromamba install llvm -c <https://repo.mamba.pm/emscripten-forge> and setting the LLVM_BUILD_DIR/$env:LLVM_BUILD_DIR appropriately)

```bash
git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.git
git clone --depth=1 --branch release/21.x https://github.com/llvm/llvm-project.git
git clone --depth=1 https://github.com/compiler-research/CppInterOp.git
```

Expand All @@ -55,16 +55,16 @@ executing

```bash
cd ./llvm-project/
git apply -v ../CppInterOp/patches/llvm/emscripten-clang20-*.patch
git apply -v ../CppInterOp/patches/llvm/emscripten-clang21-*.patch
```

On Windows execute the following

```powershell
cd .\llvm-project\
cp -r ..\patches\llvm\emscripten-clang20*
git apply -v emscripten-clang20-2-shift-temporary-files-to-tmp-dir.patch
git apply -v emscripten-clang20-3-enable_exception_handling.patch
cp -r ..\patches\llvm\emscripten-clang21*
git apply -v emscripten-clang21-1-shift-temporary-files-to-tmp-dir.patch
git apply -v emscripten-clang21-2-enable_exception_handling.patch
```

We are now in a position to build an emscripten build of llvm by executing the following on Linux
Expand Down Expand Up @@ -343,7 +343,7 @@ of llvm you are building against)
```bash
cd ../..
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
export LLVM_VERSION=20
export LLVM_VERSION=21
cd ./xeus-cpp
mkdir build
cd build
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git

#### Setup Clang-REPL

Clone the 20.x release of the LLVM project repository.
Clone the 21.x release of the LLVM project repository.

```bash
git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.git
git clone --depth=1 --branch release/21.x https://github.com/llvm/llvm-project.git
cd llvm-project
```

Expand Down Expand Up @@ -406,10 +406,10 @@ git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git

#### Setup Clang-REPL

Clone the 20.x release of the LLVM project repository.
Clone the 21.x release of the LLVM project repository.

```bash
git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.git
git clone --depth=1 --branch release/21.x https://github.com/llvm/llvm-project.git
cd llvm-project
```

Expand Down
4 changes: 2 additions & 2 deletions docs/DevelopersDocumentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ library
Setup Clang-REPL
******************

Clone the 20.x release of the LLVM project repository.
Clone the 21.x release of the LLVM project repository.

.. code:: bash

git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.git
git clone --depth=1 --branch release/21.x https://github.com/llvm/llvm-project.git
cd llvm-project

******************
Expand Down
14 changes: 7 additions & 7 deletions docs/Emscripten-build-instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ and on Windows execute in Powershell
$env:PWD_DIR= $PWD.Path
$env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot"

Now clone the 20.x release of the LLVM project repository and CppInterOp
Now clone the 21.x release of the LLVM project repository and CppInterOp
(the building of the emscripten version of llvm can be avoided by
executing micromamba install llvm -c
<https://repo.mamba.pm/emscripten-forge> and setting the LLVM_BUILD_DIR/$env:LLVM_BUILD_DIR
appropriately)

.. code:: bash

git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.git
git clone --depth=1 --branch release/21.x https://github.com/llvm/llvm-project.git
git clone --depth=1 https://github.com/compiler-research/CppInterOp.git

Now move into the cloned llvm-project folder and apply the required patches. On Linux and osx this
Expand All @@ -74,16 +74,16 @@ executing
.. code:: bash

cd ./llvm-project/
git apply -v ../CppInterOp/patches/llvm/emscripten-clang20-*.patch
git apply -v ../CppInterOp/patches/llvm/emscripten-clang21-*.patch

On Windows execute the following

.. code:: powershell

cd .\llvm-project\
cp -r ..\patches\llvm\emscripten-clang20*
git apply -v emscripten-clang20-2-shift-temporary-files-to-tmp-dir.patch
git apply -v emscripten-clang20-3-enable_exception_handling.patch
cp -r ..\patches\llvm\emscripten-clang21*
git apply -v emscripten-clang21-1-shift-temporary-files-to-tmp-dir.patch
git apply -v emscripten-clang21-2-enable_exception_handling.patch

We are now in a position to build an emscripten build of llvm by executing the following on Linux
and osx
Expand Down Expand Up @@ -365,7 +365,7 @@ build folder, you can build the wasm version of xeus-cpp by executing

cd ../..
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
export LLVM_VERSION=20
export LLVM_VERSION=21
cd ./xeus-cpp
mkdir build
cd build
Expand Down
4 changes: 2 additions & 2 deletions docs/InstallationAndUsage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ library
Setup Clang-REPL
******************

Clone the 20.x release of the LLVM project repository.
Clone the 21.x release of the LLVM project repository.

.. code:: bash

git clone --depth=1 --branch release/20.x https://github.com/llvm/llvm-project.git
git clone --depth=1 --branch release/21.x https://github.com/llvm/llvm-project.git
cd llvm-project

******************
Expand Down
2 changes: 1 addition & 1 deletion docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ infrastructure are described first.
## External Dependencies

- CppInterOp now works with:
- llvm20
- llvm21

## Introspection

Expand Down
24 changes: 22 additions & 2 deletions lib/CppInterOp/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ static inline char* GetEnv(const char* Var_Name) {
#endif
}

#if CLANG_VERSION_MAJOR < 21
#define Print_Canonical_Types PrintCanonicalTypes
#else
#define Print_Canonical_Types PrintAsCanonical
#endif

#if CLANG_VERSION_MAJOR < 21
#define clang_LookupResult_Found clang::LookupResult::Found
#define clang_LookupResult_Not_Found clang::LookupResult::NotFound
#define clang_LookupResult_Found_Overloaded clang::LookupResult::FoundOverloaded
#else
#define clang_LookupResult_Found clang::LookupResultKind::Found
#define clang_LookupResult_Not_Found clang::LookupResultKind::NotFound
#define clang_LookupResult_Found_Overloaded \
clang::LookupResultKind::FoundOverloaded
#endif

#if CLANG_VERSION_MAJOR < 19
#define Template_Deduction_Result Sema::TemplateDeductionResult
#define Template_Deduction_Result_Success \
Expand Down Expand Up @@ -412,11 +429,14 @@ inline void InstantiateClassTemplateSpecialization(
#if CLANG_VERSION_MAJOR < 20
interp.getSema().InstantiateClassTemplateSpecialization(
clang::SourceLocation::getFromRawEncoding(1), CTSD,
clang::TemplateSpecializationKind::TSK_Undeclared, /*Complain=*/true);

clang::TemplateSpecializationKind::TSK_ExplicitInstantiationDefinition,
/*Complain=*/true);
#else
interp.getSema().InstantiateClassTemplateSpecialization(
clang::SourceLocation::getFromRawEncoding(1), CTSD,
clang::TemplateSpecializationKind::TSK_Undeclared, /*Complain=*/true,
clang::TemplateSpecializationKind::TSK_ExplicitInstantiationDefinition,
/*Complain=*/true,
/*PrimaryHasMatchedPackOnParmToNonPackOnArg=*/false);
#endif
}
Expand Down
Loading
Loading