From 638de2a60d1b8e3bab7a294bd0564d2d03d588a2 Mon Sep 17 00:00:00 2001 From: Aaron Jomy Date: Sat, 18 Jan 2025 14:22:48 +0100 Subject: [PATCH 1/2] Improve offset initialization in getExecutionEngine --- lib/Interpreter/Compatibility.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Interpreter/Compatibility.h b/lib/Interpreter/Compatibility.h index 5c62515d5..f2a5c832a 100644 --- a/lib/Interpreter/Compatibility.h +++ b/lib/Interpreter/Compatibility.h @@ -117,11 +117,13 @@ inline llvm::orc::LLJIT* getExecutionEngine(cling::Interpreter& I) { return I.getExecutionEngine(); #endif + unsigned m_ExecutorOffset = 0; + #if CLANG_VERSION_MAJOR == 13 #ifdef __APPLE__ - const unsigned m_ExecutorOffset = 62; + m_ExecutorOffset = 62; #else - const unsigned m_ExecutorOffset = 72; + m_ExecutorOffset = 72; #endif // __APPLE__ #endif @@ -129,9 +131,9 @@ inline llvm::orc::LLJIT* getExecutionEngine(cling::Interpreter& I) { // a thread safe context - llvm::orc::ThreadSafeContext #if CLANG_VERSION_MAJOR == 16 #ifdef __APPLE__ - const unsigned m_ExecutorOffset = 68; + m_ExecutorOffset = 68; #else - const unsigned m_ExecutorOffset = 78; + m_ExecutorOffset = 78; #endif // __APPLE__ #endif From 4f2c9766164f4444514fd0cef702c654c3f937b9 Mon Sep 17 00:00:00 2001 From: Aaron Jomy Date: Sat, 18 Jan 2025 14:23:56 +0100 Subject: [PATCH 2/2] Minor patches to unittests - Sets cmake environment property of CppInterOp unitests to LLVM include dir - Use cling::Declare instead of Process for include tests This hints towards a bug in cling::Process when we JIT two includes one after another like ``` std::string code = R"(#include \n #include )" Interp->process(code); --- unittests/CMakeLists.txt | 1 + unittests/CppInterOp/ScopeReflectionTest.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 6fe08a061..972b1e475 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -33,6 +33,7 @@ endif() add_test(NAME cppinterop-${name} COMMAND ${name}) set_tests_properties(cppinterop-${name} PROPERTIES TIMEOUT "${TIMEOUT_VALUE}" + ENVIRONMENT "CPLUS_INCLUDE_PATH=${CMAKE_BINARY_DIR}/etc" LABELS DEPENDS) # FIXME: Just call gtest_add_tests this function is available. diff --git a/unittests/CppInterOp/ScopeReflectionTest.cpp b/unittests/CppInterOp/ScopeReflectionTest.cpp index 76ebf4d44..b3edf5b00 100644 --- a/unittests/CppInterOp/ScopeReflectionTest.cpp +++ b/unittests/CppInterOp/ScopeReflectionTest.cpp @@ -1022,7 +1022,7 @@ TEST(ScopeReflectionTest, IncludeVector) { #include #include )"; - Interp->process(code); + Interp->declare(code); } TEST(ScopeReflectionTest, GetOperator) {