diff --git a/.github/workflows/non-emscripten.yml b/.github/workflows/non-emscripten.yml index f0b424667..13f4b3142 100644 --- a/.github/workflows/non-emscripten.yml +++ b/.github/workflows/non-emscripten.yml @@ -53,6 +53,15 @@ jobs: cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" + - name: ubu22-x86-gcc12-clang16-cling + os: ubuntu-22.04 + compiler: gcc-12 + clang-runtime: '16' + cling: On + cling-version: '1.1' + cppyy: On + llvm_enable_projects: "clang" + llvm_targets_to_build: "host;NVPTX" - name: ubu22-x86-gcc9-clang13-cling os: ubuntu-22.04 compiler: gcc-9 @@ -118,6 +127,15 @@ jobs: cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" + - name: osx15-arm-clang-clang16-cling + os: macos-15 + compiler: clang + clang-runtime: '16' + cling: On + cling-version: '1.1' + cppyy: On + llvm_enable_projects: "clang" + llvm_targets_to_build: "host;NVPTX" - name: osx15-arm-clang-clang13-cling os: macos-15 compiler: clang @@ -159,6 +177,15 @@ jobs: cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" + - name: osx13-x86-clang-clang16-cling + os: macos-13 + compiler: clang + clang-runtime: '16' + cling: On + cling-version: '1.1' + cppyy: On + llvm_enable_projects: "clang" + llvm_targets_to_build: "host;NVPTX" - name: osx13-x86-clang-clang13-cling os: macos-13 compiler: clang @@ -385,6 +412,13 @@ jobs: git clone https://github.com/root-project/cling.git cd ./cling git checkout tags/v${{ matrix.cling-version }} + # Apply patches + llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]') + if [[ "${llvm_vers}" == "16" ]]; then + # cling version 1.1 with llvm 16 requires a patch to fix error handling when parsing invaild code + git apply -v ../patches/llvm/cling${{ matrix.clang-runtime }}-*.patch + echo "Apply cling${{ matrix.clang-runtime }}-*.patch patches:" + fi cd .. git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git else # repl @@ -411,8 +445,10 @@ jobs: ../llvm cmake --build . --target clang --parallel ${{ env.ncpus }} cmake --build . --target cling --parallel ${{ env.ncpus }} - # Now build gtest.a and gtest_main for CppInterOp to run its tests. - cmake --build . --target gtest_main --parallel ${{ env.ncpus }} + if [[ "${{ matrix.clang-runtime}}" == "13" ]]; then + # Now build gtest.a and gtest_main for CppInterOp to run its tests. + cmake --build . --target gtest_main --parallel ${{ env.ncpus }} + fi else # Apply patches llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]') @@ -461,6 +497,11 @@ jobs: git clone https://github.com/root-project/cling.git cd ./cling git checkout tags/v${{ matrix.cling-version }} + if ( "${{ matrix.clang-runtime }}" -imatch "16" ) + { + # cling version 1.1 with llvm 16 requires a patch to fix error handling when parsing invaild code + git apply -v clang16-1-Error-Handling.patch + } cd .. git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git $env:PWD_DIR= $PWD.Path @@ -494,8 +535,12 @@ jobs: ..\llvm cmake --build . --config Release --target clang --parallel ${{ env.ncpus }} cmake --build . --config Release --target cling --parallel ${{ env.ncpus }} - # Now build gtest.a and gtest_main for CppInterOp to run its tests. - cmake --build . --config Release --target gtest_main --parallel ${{ env.ncpus }} + if ( "${{ matrix.clang-runtime }}" -imatch "13" ) + { + # cling version 1.0 with llvm 13 doesn't work on Windows, but this is here in + # case someone finds a way to fix this + cmake --build . --config Release --target gtest_main --parallel ${{ env.ncpus }} + } } else { @@ -595,6 +640,13 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off + - name: ubu22-x86-gcc12-clang16-cling + os: ubuntu-22.04 + compiler: gcc-12 + clang-runtime: '16' + cling: On + cling-version: '1.1' + cppyy: Off - name: ubu22-x86-gcc9-clang13-cling-cppyy os: ubuntu-22.04 compiler: gcc-9 @@ -652,6 +704,13 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off + - name: osx15-arm-clang-clang16-cling-cppyy + os: macos-15 + compiler: clang + clang-runtime: '16' + cling: On + cling-version: '1.1' + cppyy: Off - name: osx15-arm-clang-clang13-cling-cppyy os: macos-15 compiler: clang @@ -683,13 +742,20 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off + - name: osx13-x86-clang-clang16-cling + os: macos-13 + compiler: clang + clang-runtime: '16' + cling: On + cling-version: '1.1' + cppyy: Off - name: osx13-x86-clang-clang13-cling-cppyy os: macos-13 compiler: clang clang-runtime: '13' cling: On cling-version: '1.0' - cppyy: On + cppyy: Off steps: - uses: actions/checkout@v4 diff --git a/patches/llvm/cling16-1-Error-Handling.patch b/patches/llvm/cling16-1-Error-Handling.patch new file mode 100644 index 000000000..0eb60ed51 --- /dev/null +++ b/patches/llvm/cling16-1-Error-Handling.patch @@ -0,0 +1,17 @@ +diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp +index 89cd78d..2aea40d 100644 +--- a/lib/Interpreter/IncrementalParser.cpp ++++ b/lib/Interpreter/IncrementalParser.cpp +@@ -911,8 +911,11 @@ namespace cling { + PP.EnterSourceFile(FID, /*DirLookup*/nullptr, NewLoc); + m_Consumer->getTransaction()->setBufferFID(FID); + +- if (!ParseOrWrapTopLevelDecl()) ++ llvm::Expected res = ParseOrWrapTopLevelDecl(); ++ if (!res) { ++ llvm::consumeError(std::move(res.takeError())); + return kFailed; ++ } + + if (PP.getLangOpts().DelayedTemplateParsing) { + // Microsoft-specific: diff --git a/unittests/CppInterOp/CUDATest.cpp b/unittests/CppInterOp/CUDATest.cpp index ea171b46e..aafb7505f 100644 --- a/unittests/CppInterOp/CUDATest.cpp +++ b/unittests/CppInterOp/CUDATest.cpp @@ -9,7 +9,10 @@ using namespace TestUtils; static bool HasCudaSDK() { auto supportsCudaSDK = []() { -#if CLANG_VERSION_MAJOR < 16 +#ifdef USE_CLING +// FIXME: Enable this for cling. + return false; +#elif CLANG_VERSION_MAJOR < 16 // FIXME: Enable this for cling. return false; #endif // CLANG_VERSION_MAJOR < 16 @@ -23,7 +26,10 @@ static bool HasCudaSDK() { static bool HasCudaRuntime() { auto supportsCuda = []() { -#if CLANG_VERSION_MAJOR < 16 +#ifdef USE_CLING +// FIXME: Enable this for cling. + return false; +#elif CLANG_VERSION_MAJOR < 16 // FIXME: Enable this for cling. return false; #endif //CLANG_VERSION_MAJOR < 16 @@ -43,6 +49,8 @@ static bool HasCudaRuntime() { #if CLANG_VERSION_MAJOR < 16 TEST(DISABLED_CUDATest, Sanity) { +#elif USE_CLING +TEST(DISABLED_CUDATest, Sanity) { #else TEST(CUDATest, Sanity) { #endif // CLANG_VERSION_MAJOR < 16