Skip to content

Commit f00492f

Browse files
authored
Merge branch 'main' into Windows-shared-library
2 parents 591e7ac + a8f3e3a commit f00492f

File tree

16 files changed

+334
-70
lines changed

16 files changed

+334
-70
lines changed

.github/workflows/MacOS.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
cling: On
5858
cling-version: '1.0'
5959
llvm_enable_projects: "clang"
60-
llvm_targets_to_build: "host"
60+
llvm_targets_to_build: "host;NVPTX"
6161
- name: osx13-x86-clang-clang-repl-19
6262
os: macos-13
6363
compiler: clang
@@ -93,7 +93,7 @@ jobs:
9393
cling: On
9494
cling-version: '1.0'
9595
llvm_enable_projects: "clang"
96-
llvm_targets_to_build: "host"
96+
llvm_targets_to_build: "host;NVPTX"
9797

9898
steps:
9999
- uses: actions/checkout@v4
@@ -256,7 +256,7 @@ jobs:
256256
-DLLVM_ENABLE_LIBXML2=OFF \
257257
-G Ninja \
258258
../llvm
259-
ninja clang clang-repl -j ${{ env.ncpus }}
259+
ninja clang clangInterpreter clangStaticAnalyzerCore -j ${{ env.ncpus }}
260260
fi
261261
cd ../
262262
rm -rf $(find . -maxdepth 1 ! -name "build" ! -name "llvm" ! -name "clang" ! -name ".")

.github/workflows/Ubuntu.yml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,42 @@ jobs:
5858
cling-version: '1.0'
5959
llvm_enable_projects: "clang"
6060
llvm_targets_to_build: "host;NVPTX"
61+
- name: ubu22-arm-gcc12-clang-repl-19
62+
os: ubuntu-22.04-arm
63+
compiler: gcc-12
64+
clang-runtime: '19'
65+
cling: Off
66+
llvm_enable_projects: "clang"
67+
llvm_targets_to_build: "host;NVPTX"
68+
- name: ubu22-arm-gcc12-clang-repl-18
69+
os: ubuntu-22.04-arm
70+
compiler: gcc-12
71+
clang-runtime: '18'
72+
cling: Off
73+
llvm_enable_projects: "clang"
74+
llvm_targets_to_build: "host;NVPTX"
75+
- name: ubu22-arm-gcc12-clang-repl-17
76+
os: ubuntu-22.04-arm
77+
compiler: gcc-12
78+
clang-runtime: '17'
79+
cling: Off
80+
llvm_enable_projects: "clang"
81+
llvm_targets_to_build: "host;NVPTX"
82+
- name: ubu22-arm-gcc12-clang-repl-16
83+
os: ubuntu-22.04-arm
84+
compiler: gcc-12
85+
clang-runtime: '16'
86+
cling: Off
87+
llvm_enable_projects: "clang"
88+
llvm_targets_to_build: "host;NVPTX"
89+
- name: ubu22-arm-gcc9-clang13-cling
90+
os: ubuntu-22.04-arm
91+
compiler: gcc-9
92+
clang-runtime: '13'
93+
cling: On
94+
cling-version: '1.0'
95+
llvm_enable_projects: "clang"
96+
llvm_targets_to_build: "host;NVPTX"
6197

6298
steps:
6399
- uses: actions/checkout@v4
@@ -271,6 +307,33 @@ jobs:
271307
cling: On
272308
cling-version: '1.0'
273309
cppyy: On
310+
- name: ubu22-arm-gcc12-clang-repl-19
311+
os: ubuntu-22.04-arm
312+
compiler: gcc-12
313+
clang-runtime: '19'
314+
cling: Off
315+
- name: ubu22-arm-gcc12-clang-repl-18
316+
os: ubuntu-22.04-arm
317+
compiler: gcc-12
318+
clang-runtime: '18'
319+
cling: Off
320+
- name: ubu22-arm-gcc12-clang-repl-17
321+
os: ubuntu-22.04-arm
322+
compiler: gcc-12
323+
clang-runtime: '17'
324+
cling: Off
325+
- name: ubu22-arm-gcc12-clang-repl-16
326+
os: ubuntu-22.04-arm
327+
compiler: gcc-12
328+
clang-runtime: '16'
329+
cling: Off
330+
cppyy: Off
331+
- name: ubu22-arm-gcc9-clang13-cling
332+
os: ubuntu-22.04-arm
333+
compiler: gcc-9
334+
clang-runtime: '13'
335+
cling: On
336+
cling-version: '1.0'
274337

275338
steps:
276339
- uses: actions/checkout@v4
@@ -411,7 +474,7 @@ jobs:
411474
cmake --build . --target sphinx-cppinterop --parallel ${{ env.ncpus }}
412475
else
413476
cmake --build . --target check-cppinterop --parallel ${{ env.ncpus }}
414-
valgrind --show-error-list=yes --track-origins=yes --error-exitcode=1 unittests/CppInterOp/CppInterOpTests
477+
valgrind --show-error-list=yes --track-origins=yes --error-exitcode=1 unittests/CppInterOp/CppInterOpTests/unittests/bin/${{ env.BUILD_TYPE }}/CppInterOpTests
415478
fi
416479
cd ..
417480
# We need CB_PYTHON_DIR later

.github/workflows/deploy-pages.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ jobs:
187187
micromamba activate xeus-lite-host
188188
python -m pip install jupyterlite-xeus jupyterlite-core jupyterlab notebook libarchive-c
189189
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --output-dir dist
190-
cp ${{ env.PREFIX }}/bin/xcpp.data dist/extensions/@jupyterlite/xeus/static
191-
cp ${{ env.PREFIX }}/lib/libclangCppInterOp.so dist/extensions/@jupyterlite/xeus/static
192190
193191
- name: Upload artifact
194192
uses: actions/upload-pages-artifact@v3

.github/workflows/emscripten.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ jobs:
2929
llvm_enable_projects: "clang;lld"
3030
llvm_targets_to_build: "WebAssembly"
3131
emsdk_ver: "3.1.45"
32+
- name: ubu22-arm-gcc12-clang-repl-19-emscripten
33+
os: ubuntu-22.04-arm
34+
compiler: gcc-12
35+
clang-runtime: '19'
36+
cling: Off
37+
llvm_enable_projects: "clang;lld"
38+
llvm_targets_to_build: "WebAssembly"
39+
emsdk_ver: "3.1.45"
3240
- name: osx15-arm-clang-clang-repl-19-emscripten
3341
os: macos-15
3442
compiler: clang
@@ -331,7 +339,22 @@ jobs:
331339
../llvm
332340
emmake ninja clang clang-repl lld -j ${{ env.ncpus }}
333341
fi
334-
cd ../..
342+
cd ../
343+
rm -rf $(find . -maxdepth 1 ! -name "build" ! -name "llvm" ! -name "clang" ! -name ".")
344+
if [[ "${cling_on}" == "ON" ]]; then
345+
cd ./llvm/
346+
rm -rf $(find . -maxdepth 1 ! -name "include" ! -name "lib" ! -name "cmake" ! -name "utils" ! -name ".")
347+
cd ../clang/
348+
rm -rf $(find . -maxdepth 1 ! -name "include" ! -name "lib" ! -name "cmake" ! -name "utils" ! -name ".")
349+
cd ../..
350+
else # repl
351+
cd ./llvm/
352+
rm -rf $(find . -maxdepth 1 ! -name "include" ! -name "lib" ! -name "cmake" ! -name ".")
353+
cd ../clang/
354+
rm -rf $(find . -maxdepth 1 ! -name "include" ! -name "lib" ! -name "cmake" ! -name ".")
355+
cd ../..
356+
fi
357+
335358
336359
- name: Build LLVM/Cling on Windows systems if the cache is invalid
337360
if: ${{ runner.os == 'windows' && steps.cache.outputs.cache-hit != 'true' }}
@@ -451,6 +474,13 @@ jobs:
451474
cling: Off
452475
micromamba_shell_init: bash
453476
emsdk_ver: "3.1.45"
477+
- name: ubu22-arm-gcc12-clang-repl-19-emscripten_wasm
478+
os: ubuntu-22.04-arm
479+
compiler: gcc-12
480+
clang-runtime: '19'
481+
cling: Off
482+
micromamba_shell_init: bash
483+
emsdk_ver: "3.1.45"
454484
- name: osx15-arm-clang-clang-repl-19-emscripten_wasm
455485
os: macos-15
456486
compiler: clang
@@ -571,6 +601,7 @@ jobs:
571601
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
572602
-DCMAKE_INSTALL_PREFIX=$PREFIX \
573603
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
604+
-DLLVM_ENABLE_WERROR=On \
574605
../
575606
else
576607
emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
@@ -582,6 +613,7 @@ jobs:
582613
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
583614
-DCMAKE_INSTALL_PREFIX=$PREFIX \
584615
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
616+
-DLLVM_ENABLE_WERROR=On \
585617
../
586618
fi
587619

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ install
3333

3434
# CLion files
3535
.idea
36+
37+
# VSCode files
38+
.vscode
39+
40+
# Default Virtual Environments
41+
.venv

CMakeLists.txt

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -462,32 +462,52 @@ endif()
462462
if(MSVC)
463463

464464
set(MSVC_EXPORTLIST
465-
??_7type_info@@6B@
466-
?nothrow@std@@3Unothrow_t@1@B
467-
_Init_thread_header
468-
_Init_thread_footer
469-
??_7type_info@@6B@
470-
?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z
465+
_Init_thread_header
466+
_Init_thread_footer
467+
?nothrow@std@@3Unothrow_t@1@B
468+
??_7type_info@@6B@
471469
)
472470

473-
set(MSVC_EXPORTLIST ${MSVC_EXPORTLIST}
474-
??2@YAPEAX_K@Z
475-
??3@YAXPEAX@Z
476-
??3@YAXPEAX_K@Z
477-
??_U@YAPEAX_K@Z
478-
??_V@YAXPEAX@Z
479-
??_V@YAXPEAX_K@Z
480-
??2@YAPEAX_KAEBUnothrow_t@std@@@Z
481-
??_U@YAPEAX_KAEBUnothrow_t@std@@@Z
482-
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@H@Z
483-
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@M@Z
484-
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@N@Z
485-
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z
486-
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z
487-
??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z
488-
??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z
489-
?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z
490-
)
471+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
472+
# new/delete variants needed when linking to static msvc runtime (esp. Debug)
473+
set(MSVC_EXPORTLIST ${MSVC_EXPORTLIST}
474+
??2@YAPEAX_K@Z
475+
??3@YAXPEAX@Z
476+
??_U@YAPEAX_K@Z
477+
??_V@YAXPEAX@Z
478+
??3@YAXPEAX_K@Z
479+
??_V@YAXPEAX_K@Z
480+
??2@YAPEAX_KAEBUnothrow_t@std@@@Z
481+
??_U@YAPEAX_KAEBUnothrow_t@std@@@Z
482+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@H@Z
483+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@M@Z
484+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@N@Z
485+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z
486+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z
487+
??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z
488+
??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z
489+
?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z
490+
)
491+
else()
492+
set(MSVC_EXPORTLIST ${MSVC_EXPORTLIST}
493+
??2@YAPAXI@Z
494+
??3@YAXPAX@Z
495+
??3@YAXPAXI@Z
496+
??_U@YAPAXI@Z
497+
??_V@YAXPAX@Z
498+
??_V@YAXPAXI@Z
499+
??2@YAPAXIABUnothrow_t@std@@@Z
500+
??_U@YAPAXIABUnothrow_t@std@@@Z
501+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z
502+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@M@Z
503+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@N@Z
504+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PBX@Z
505+
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z
506+
??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@D@Z
507+
??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z
508+
?_Facet_Register@std@@YAXPAV_Facet_base@1@@Z
509+
)
510+
endif()
491511

492512
if(MSVC_VERSION LESS 1914)
493513
set(MSVC_EXPORTLIST ${MSVC_EXPORTLIST} ??3@YAXPAX0@Z ??_V@YAXPAX0@Z)

Emscripten-build-instructions.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,6 @@ python -m pip install jupyterlite-xeus jupyter_server
153153
jupyter lite build --XeusAddon.prefix=$PREFIX --contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb
154154
```
155155

156-
We now need to shift necessary files like `xcpp.data` which contains the binary representation of the file(s)
157-
we want to include in our application. As of now this would contain all important files like Standard Headers,
158-
Libraries etc coming out of emscripten's sysroot. Assuming we are still inside build we should do the following
159-
160-
```bash
161-
cp $PREFIX/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
162-
cp $PREFIX/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
163-
```
164-
165156
Once the Jupyter Lite site has built you can test the website locally by executing
166157

167158
```bash

docs/Emscripten-build-instructions.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,6 @@ for testing execute the following
174174
python -m pip install jupyterlite-xeus jupyter_server
175175
jupyter lite build --XeusAddon.prefix=$PREFIX --contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb
176176
177-
We now need to shift necessary files like `xcpp.data` which contains the
178-
binary representation of the file(s) we want to include in our
179-
application. As of now this would contain all important files like
180-
Standard Headers, Libraries etc coming out of emscripten's sysroot.
181-
Assuming we are still inside build we should do the following
182-
183-
.. code:: bash
184-
185-
cp $PREFIX/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
186-
cp $PREFIX/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
187-
188177
Once the Jupyter Lite site has built you can test the website locally by
189178
executing
190179

include/clang/Interpreter/CppInterOp.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ namespace Cpp {
185185
///\returns the version string information of the library.
186186
CPPINTEROP_API std::string GetVersion();
187187

188+
///\returns the demangled representation of the given mangled_name
189+
CPPINTEROP_API std::string Demangle(const std::string& mangled_name);
190+
188191
/// Enables or disables the debugging printouts on stderr.
189192
/// Debugging output can be enabled also by the environment variable
190193
/// CPPINTEROP_EXTRA_INTERPRETER_ARGS. For example,
@@ -207,6 +210,10 @@ namespace Cpp {
207210
/// Checks if the scope is a class or not.
208211
CPPINTEROP_API bool IsClass(TCppScope_t scope);
209212

213+
/// Checks if the klass polymorphic.
214+
/// which means that the class contains or inherits a virtual function
215+
CPPINTEROP_API bool IsClassPolymorphic(TCppScope_t klass);
216+
210217
// See TClingClassInfo::IsLoaded
211218
/// Checks if the class definition is present, or not. Performs a
212219
/// template instantiation if necessary.

lib/Interpreter/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ if(EMSCRIPTEN)
1717
LINK_LIBS
1818
clangInterpreter
1919
)
20+
#FIXME: Setting no_soname=1 is needed until https://github.com/emscripten-core/emscripten/blob/ac676d5e437525d15df5fd46bc2c208ec6d376a3/cmake/Modules/Platform/Emscripten.cmake#L36
21+
# is patched out of emsdk, as --soname is not recognised by emscripten. A PR to do this has been done here https://github.com/emscripten-core/emscripten/pull/23453
22+
#FIXME: A patch is needed to llvm to remove -Wl,-z,defs since it is now recognised on emscripten. What needs to be removed is here
23+
# https://github.com/llvm/llvm-project/blob/128e2e446e90c3b1827cfc7d4d19e3c0976beff3/llvm/cmake/modules/HandleLLVMOptions.cmake#L318 . The PR to do try to do this is here
24+
# https://github.com/llvm/llvm-project/pull/123396
25+
set_target_properties(clangCppInterOp
26+
PROPERTIES NO_SONAME 1
27+
)
2028
target_link_options(clangCppInterOp PRIVATE
2129
PUBLIC "SHELL: -s WASM_BIGINT"
2230
)

0 commit comments

Comments
 (0)