Skip to content

Commit 9977082

Browse files
committed
[TCling] Invoke InterOp interpreter API in metacling
1 parent df7264a commit 9977082

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: core/metacling/src/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ target_include_directories(MetaCling SYSTEM PRIVATE
4444
${CLANG_INCLUDE_DIRS}
4545
${LLVM_INCLUDE_DIRS}
4646
${CLAD_INCLUDE_DIRS}
47+
${CPPINTEROP_INCLUDE_DIRS}
4748
)
4849

4950
target_include_directories(MetaCling PRIVATE
@@ -74,7 +75,7 @@ if(MSVC)
7475
set_source_files_properties(TCling.cxx COMPILE_FLAGS /bigobj)
7576
endif()
7677

77-
add_dependencies(MetaCling CLING)
78+
add_dependencies(MetaCling CLING clangCppInterOp)
7879

7980
##### libCling #############################################################
8081

@@ -113,6 +114,7 @@ ROOT_LINKER_LIBRARY(Cling
113114
$<TARGET_OBJECTS:ClingUtils>
114115
$<TARGET_OBJECTS:Dictgen>
115116
$<TARGET_OBJECTS:MetaCling>
117+
$<TARGET_OBJECTS:clangCppInterOp>
116118
LIBRARIES ${CLING_LIBRARIES} ${LINK_LIBS} ${CLING_PLUGIN_LINK_LIBS})
117119

118120
# When these two link at the same time, they can exhaust the RAM on many machines, since they both link against llvm.

Diff for: core/metacling/src/TCling.cxx

+7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ clang/LLVM technology.
115115
#include "cling/Utils/SourceNormalization.h"
116116
#include "cling/Interpreter/Exception.h"
117117

118+
#include "clang/Interpreter/CppInterOp.h"
119+
118120
#include "llvm/IR/GlobalValue.h"
119121
#include "llvm/IR/Module.h"
120122

@@ -1539,6 +1541,11 @@ TCling::TCling(const char *name, const char *title, const char* const argv[], vo
15391541
if (!fInterpreter->getCI()) { // Compiler instance could not be created. See https://its.cern.ch/jira/browse/ROOT-10239
15401542
return;
15411543
}
1544+
1545+
// Tell CppInterOp that the cling::Interpreter instance is managed externally by ROOT
1546+
// Sets the interpreter by passing the fInterpreter handle as soon as TCling is initialized
1547+
Cpp::UseExternalInterpreter((Cpp::TInterp_t*)fInterpreter.get());
1548+
15421549
// Don't check whether modules' files exist.
15431550
fInterpreter->getCI()->getPreprocessorOpts().DisablePCHOrModuleValidation =
15441551
DisableValidationForModuleKind::All;

0 commit comments

Comments
 (0)