Skip to content

Commit 0d9e21d

Browse files
authored
Apply patch needed to fix error handling for cling version 1.1
1 parent 05f2544 commit 0d9e21d

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ jobs:
366366
git clone https://github.com/root-project/cling.git
367367
cd ./cling
368368
git checkout tags/v${{ matrix.cling-version }}
369+
# Apply patches
370+
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
371+
if [[ "${llvm_vers}" == "16" ]]; then
372+
# cling version 1.1 with llvm 16 requires a patch to fix error handling when parsing invaild code
373+
git apply -v ../patches/llvm/cling${{ matrix.clang-runtime }}-*.patch
374+
echo "Apply cling${{ matrix.clang-runtime }}-*.patch patches:"
375+
fi
369376
cd ..
370377
git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git
371378
else # repl
@@ -435,6 +442,11 @@ jobs:
435442
git clone https://github.com/root-project/cling.git
436443
cd ./cling
437444
git checkout tags/v${{ matrix.cling-version }}
445+
if ( "${{ matrix.clang-runtime }}" -imatch "16" )
446+
{
447+
# cling version 1.1 with llvm 16 requires a patch to fix error handling when parsing invaild code
448+
git apply -v clang16-1-Error-Handling.patch
449+
}
438450
cd ..
439451
git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git
440452
$env:PWD_DIR= $PWD.Path
@@ -558,13 +570,13 @@ jobs:
558570
clang-runtime: '16'
559571
cling: Off
560572
cppyy: Off
561-
- name: ubu22-x86-gcc9-clang16-cling-cppyy
573+
- name: ubu22-x86-gcc9-clang16-cling
562574
os: ubuntu-22.04
563575
compiler: gcc-12
564576
clang-runtime: '16'
565577
cling: On
566578
cling-version: '1.1'
567-
cppyy: On
579+
cppyy: Off
568580
#FIXME: Windows CppInterOp tests expected to fail
569581
#until https://github.com/compiler-research/CppInterOp/issues/188 is solved
570582
- name: win2022-msvc-clang-repl-19
@@ -615,13 +627,13 @@ jobs:
615627
clang-runtime: '16'
616628
cling: Off
617629
cppyy: Off
618-
- name: osx14-arm-clang-clang16-cling-cppyy
630+
- name: osx14-arm-clang-clang16-cling
619631
os: macos-14
620632
compiler: clang
621633
clang-runtime: '16'
622634
cling: On
623635
cling-version: '1.1'
624-
cppyy: On
636+
cppyy: Off
625637
- name: osx13-x86-clang-clang-repl-19-cppyy
626638
os: macos-13
627639
compiler: clang
@@ -646,13 +658,13 @@ jobs:
646658
clang-runtime: '16'
647659
cling: Off
648660
cppyy: Off
649-
- name: osx13-x86-clang-clang16-cling-cppyy
661+
- name: osx13-x86-clang-clang16-cling
650662
os: macos-13
651663
compiler: clang
652664
clang-runtime: '16'
653665
cling: On
654666
cling-version: '1.1'
655-
cppyy: On
667+
cppyy: Off
656668

657669
steps:
658670
- uses: actions/checkout@v4
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp
2+
index 89cd78d..2aea40d 100644
3+
--- a/lib/Interpreter/IncrementalParser.cpp
4+
+++ b/lib/Interpreter/IncrementalParser.cpp
5+
@@ -911,8 +911,11 @@ namespace cling {
6+
PP.EnterSourceFile(FID, /*DirLookup*/nullptr, NewLoc);
7+
m_Consumer->getTransaction()->setBufferFID(FID);
8+
9+
- if (!ParseOrWrapTopLevelDecl())
10+
+ llvm::Expected<bool> res = ParseOrWrapTopLevelDecl();
11+
+ if (!res) {
12+
+ llvm::consumeError(std::move(res.takeError()));
13+
return kFailed;
14+
+ }
15+
16+
if (PP.getLangOpts().DelayedTemplateParsing) {
17+
// Microsoft-specific:

0 commit comments

Comments
 (0)