Skip to content

Commit 3b4ba89

Browse files
authored
Merge branch 'main' into stl-convertors-fix
2 parents 576e8b1 + 12e6e69 commit 3b4ba89

File tree

13 files changed

+489
-77
lines changed

13 files changed

+489
-77
lines changed

.github/workflows/ci.yml

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
include:
24+
- name: ubu22-x86-gcc12-clang-repl-19
25+
os: ubuntu-22.04
26+
compiler: gcc-12
27+
clang-runtime: '19'
28+
cling: Off
29+
cppyy: On
30+
coverage: true
2431
- name: ubu22-x86-gcc12-clang-repl-18
2532
os: ubuntu-22.04
2633
compiler: gcc-12
@@ -50,6 +57,12 @@ jobs:
5057
cling-version: '1.0'
5158
cppyy: On
5259
coverage: true
60+
- name: win2022-msvc-clang-repl-19
61+
os: windows-2022
62+
compiler: msvc
63+
clang-runtime: '19'
64+
cling: Off
65+
cppyy: Off
5366
- name: win2022-msvc-clang-repl-18
5467
os: windows-2022
5568
compiler: msvc
@@ -75,6 +88,12 @@ jobs:
7588
cling: On
7689
cling-version: '1.0'
7790
cppyy: Off
91+
- name: osx14-arm-clang-clang-repl-19
92+
os: macos-14
93+
compiler: clang
94+
clang-runtime: '19'
95+
cling: Off
96+
cppyy: On
7897
- name: osx14-arm-clang-clang-repl-18
7998
os: macos-14
8099
compiler: clang
@@ -100,6 +119,12 @@ jobs:
100119
cling: On
101120
cling-version: '1.0'
102121
cppyy: On
122+
- name: osx13-x86-clang-clang-repl-19
123+
os: macos-13
124+
compiler: clang
125+
clang-runtime: '19'
126+
cling: Off
127+
cppyy: On
103128
- name: osx13-x86-clang-clang-repl-18
104129
os: macos-13
105130
compiler: clang
@@ -350,7 +375,7 @@ jobs:
350375
else
351376
# Apply patches
352377
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
353-
if [[ "${llvm_vers}" != "18" ]]; then
378+
if [[ "${llvm_vers}" == "16" ]]||[[ "${llvm_vers}" == "17" ]]; then
354379
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
355380
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
356381
fi
@@ -399,10 +424,10 @@ jobs:
399424
if ( "${{ matrix.cling }}" -imatch "On" )
400425
{
401426
cd build
402-
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" `
427+
cmake -DLLVM_ENABLE_PROJECTS="clang" `
403428
-DLLVM_EXTERNAL_PROJECTS=cling `
404429
-DLLVM_EXTERNAL_CLING_SOURCE_DIR="$env:CLING_DIR" `
405-
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" `
430+
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" `
406431
-DCMAKE_BUILD_TYPE=Release `
407432
-DLLVM_ENABLE_ASSERTIONS=ON `
408433
-DCLANG_ENABLE_STATIC_ANALYZER=OFF `
@@ -413,7 +438,6 @@ jobs:
413438
-DLLVM_ENABLE_TERMINFO=OFF `
414439
-DLLVM_ENABLE_LIBXML2=OFF `
415440
..\llvm
416-
cmake --build . --config Release --target lld --parallel ${{ env.ncpus }}
417441
cmake --build . --config Release --target clang --parallel ${{ env.ncpus }}
418442
cmake --build . --config Release --target cling --parallel ${{ env.ncpus }}
419443
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
@@ -435,8 +459,8 @@ jobs:
435459
}
436460
cd build
437461
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
438-
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" `
439-
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" `
462+
cmake -DLLVM_ENABLE_PROJECTS="clang" `
463+
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" `
440464
-DCMAKE_BUILD_TYPE=Release `
441465
-DLLVM_ENABLE_ASSERTIONS=ON `
442466
-DCLANG_ENABLE_STATIC_ANALYZER=OFF `
@@ -447,7 +471,7 @@ jobs:
447471
-DLLVM_ENABLE_TERMINFO=OFF `
448472
-DLLVM_ENABLE_LIBXML2=OFF `
449473
..\llvm
450-
cmake --build . --config Release --target clang clang-repl lld --parallel ${{ env.ncpus }}
474+
cmake --build . --config Release --target clang clang-repl --parallel ${{ env.ncpus }}
451475
}
452476
cd ..\
453477
rm -r -force $(find.exe . -maxdepth 1 ! -name "build" ! -name "llvm" ! -name "clang" ! -name ".")
@@ -470,6 +494,13 @@ jobs:
470494
fail-fast: false
471495
matrix:
472496
include:
497+
- name: ubu22-x86-gcc12-clang-repl-19-cppyy
498+
os: ubuntu-22.04
499+
compiler: gcc-12
500+
clang-runtime: '19'
501+
cling: Off
502+
cppyy: On
503+
coverage: true
473504
- name: ubu22-x86-gcc12-clang-repl-18-cppyy
474505
os: ubuntu-22.04
475506
compiler: gcc-12
@@ -498,6 +529,12 @@ jobs:
498529
cppyy: On
499530
#FIXME: Windows CppInterOp tests expected to fail
500531
#until https://github.com/compiler-research/CppInterOp/issues/188 is solved
532+
- name: win2022-msvc-clang-repl-19
533+
os: windows-2022
534+
compiler: msvc
535+
clang-runtime: '19'
536+
cling: Off
537+
cppyy: Off
501538
- name: win2022-msvc-clang-repl-18
502539
os: windows-2022
503540
compiler: msvc
@@ -542,6 +579,12 @@ jobs:
542579
# cling: On
543580
# cling-version: '1.0'
544581
# cppyy: On
582+
- name: osx14-arm-clang-clang-repl-19-cppyy
583+
os: macos-14
584+
compiler: clang
585+
clang-runtime: '19'
586+
cling: Off
587+
cppyy: On
545588
- name: osx14-arm-clang-clang-repl-18-cppyy
546589
os: macos-14
547590
compiler: clang
@@ -567,6 +610,12 @@ jobs:
567610
cling: On
568611
cling-version: '1.0'
569612
cppyy: On
613+
- name: osx13-x86-clang-clang-repl-19-cppyy
614+
os: macos-13
615+
compiler: clang
616+
clang-runtime: '19'
617+
cling: Off
618+
cppyy: On
570619
- name: osx13-x86-clang-clang-repl-18-cppyy
571620
os: macos-13
572621
compiler: clang
@@ -1076,6 +1125,12 @@ jobs:
10761125
fail-fast: false
10771126
matrix:
10781127
include:
1128+
- name: ubu22-x86-gcc12-clang-repl-19-emscripten_wasm
1129+
os: ubuntu-22.04
1130+
compiler: gcc-12
1131+
clang-runtime: '19'
1132+
cling: Off
1133+
micromamba_shell_init: bash
10791134
- name: ubu22-x86-gcc12-clang-repl-18-emscripten_wasm
10801135
os: ubuntu-22.04
10811136
compiler: gcc-12
@@ -1101,6 +1156,12 @@ jobs:
11011156
cling: On
11021157
cling-version: '1.0'
11031158
micromamba_shell_init: bash
1159+
- name: osx14-arm-clang-clang-repl-19-emscripten_wasm
1160+
os: macos-14
1161+
compiler: clang
1162+
clang-runtime: '19'
1163+
cling: Off
1164+
micromamba_shell_init: bash
11041165
- name: osx14-arm-clang-clang-repl-18-emscripten_wasm
11051166
os: macos-14
11061167
compiler: clang
@@ -1126,6 +1187,12 @@ jobs:
11261187
cling: On
11271188
cling-version: '1.0'
11281189
micromamba_shell_init: bash
1190+
- name: osx13-x86-clang-clang-repl-19-emscripten_wasm
1191+
os: macos-13
1192+
compiler: clang
1193+
clang-runtime: '19'
1194+
cling: Off
1195+
micromamba_shell_init: bash
11291196
- name: osx13-x86-clang-clang-repl-18-emscripten_wasm
11301197
os: macos-13
11311198
compiler: clang

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
5959
## Define supported version of clang and llvm
6060

6161
set(CLANG_MIN_SUPPORTED 13.0)
62-
set(CLANG_MAX_SUPPORTED "18.1.x")
63-
set(CLANG_VERSION_UPPER_BOUND 19.0.0)
62+
set(CLANG_MAX_SUPPORTED "19.1.x")
63+
set(CLANG_VERSION_UPPER_BOUND 20.0.0)
6464
set(LLVM_MIN_SUPPORTED 13.0)
65-
set(LLVM_MAX_SUPPORTED "18.1.x")
66-
set(LLVM_VERSION_UPPER_BOUND 19.0.0)
65+
set(LLVM_MAX_SUPPORTED "19.1.x")
66+
set(LLVM_VERSION_UPPER_BOUND 20.0.0)
6767

6868
## Set Cmake packages search order
6969

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,20 @@ git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git
7777
```
7878

7979
#### Setup Clang-REPL
80-
Clone the 17.x release of the LLVM project repository.
80+
Clone the 18.x release of the LLVM project repository.
8181
```
82-
git clone --depth=1 --branch release/17.x https://github.com/llvm/llvm-project.git
82+
git clone --depth=1 --branch release/18.x https://github.com/llvm/llvm-project.git
8383
cd llvm-project
8484
```
85-
Get the following patches required for development work. To apply these patches on Linux and MacOS execute the following command
85+
86+
For Clang 16 & 17, the following patches required for development work. To apply these patches on Linux and MacOS execute the following command(substitute `{version}` with your clang version):
8687
```
87-
git apply -v ../CppInterOp/patches/llvm/clang17-*.patch
88+
git apply -v ../CppInterOp/patches/llvm/clang{version}-*.patch
8889
```
8990
and
9091
```
9192
cp -r ..\CppInterOp\patches\llvm\clang17* .
92-
git apply -v clang17-1-NewOperator.patch
93+
git apply -v clang{version}-*.patch
9394
```
9495
on Windows.
9596

include/clang/Interpreter/CppInterOp.h

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,43 @@ namespace Cpp {
3535
using TCppFuncAddr_t = void*;
3636
using TInterp_t = void*;
3737
using TCppObject_t = void*;
38+
39+
enum BinaryOperator {
40+
PtrMemD = 0,
41+
PtrMemI,
42+
Mul,
43+
Div,
44+
Rem,
45+
Add,
46+
Sub,
47+
Shl,
48+
Shr,
49+
Cmp,
50+
LT,
51+
GT,
52+
LE,
53+
GE,
54+
EQ,
55+
NE,
56+
And,
57+
Xor,
58+
Or,
59+
LAnd,
60+
LOr,
61+
Assign,
62+
MulAssign,
63+
DivAssign,
64+
RemAssign,
65+
AddAssign,
66+
SubAssign,
67+
ShlAssign,
68+
ShrAssign,
69+
AndAssign,
70+
XorAssign,
71+
OrAssign,
72+
Comma,
73+
};
74+
3875
/// A class modeling function calls for functions produced by the interpreter
3976
/// in compiled code. It provides an information if we are calling a standard
4077
/// function, constructor or destructor.
@@ -387,11 +424,16 @@ namespace Cpp {
387424
/// Checks if the provided parameter is a 'Virtual' method.
388425
CPPINTEROP_API bool IsVirtualMethod(TCppFunction_t method);
389426

390-
/// Gets all the Fields/Data Members of a Class. For now, it
391-
/// only gets non-static data members but in a future update,
392-
/// it may support getting static data members as well.
427+
/// Gets all the Fields/Data Members of a Class
393428
CPPINTEROP_API std::vector<TCppScope_t> GetDatamembers(TCppScope_t scope);
394429

430+
/// Gets all the Static Fields/Data Members of a Class
431+
///\param[in] scope - class
432+
///\param[out] funcs - vector of static data members
433+
CPPINTEROP_API void
434+
GetStaticDatamembers(TCppScope_t scope,
435+
std::vector<TCppScope_t>& datamembers);
436+
395437
/// This is a Lookup function to be used specifically for data members.
396438
CPPINTEROP_API TCppScope_t LookupDatamember(const std::string& name,
397439
TCppScope_t parent);
@@ -464,6 +506,10 @@ namespace Cpp {
464506
CPPINTEROP_API std::string GetFunctionArgName(TCppFunction_t func,
465507
TCppIndex_t param_index);
466508

509+
///\returns function that performs operation op on lc and rc
510+
void GetBinaryOperator(TCppScope_t scope, enum BinaryOperator op,
511+
std::vector<TCppFunction_t>& operators);
512+
467513
/// Creates an instance of the interpreter we need for the various interop
468514
/// services.
469515
///\param[in] Args - the list of arguments for interpreter constructor.
@@ -507,6 +553,13 @@ namespace Cpp {
507553
/// GetResourceDir() function.
508554
CPPINTEROP_API void AddIncludePath(const char* dir);
509555

556+
// Gets the currently used include paths
557+
///\param[out] IncludePaths - the list of include paths
558+
///
559+
CPPINTEROP_API void GetIncludePaths(std::vector<std::string>& IncludePaths,
560+
bool withSystem = false,
561+
bool withFlags = false);
562+
510563
/// Only Declares a code snippet in \c code and does not execute it.
511564
///\returns 0 on success
512565
CPPINTEROP_API int Declare(const char* code, bool silent = false);

0 commit comments

Comments
 (0)