Skip to content

Commit ef871f9

Browse files
committed
[TCling] Invoke InterOp interpreter API in metacling
This uses provides InterOp with the TInterpreter instance created by ROOT in TCling. The InterOp API can now be used without providing interpreter ownership.
1 parent 6e0e6da commit ef871f9

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

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

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ if(MSVC)
7676
endif()
7777

7878
add_dependencies(MetaCling CLING clangCppInterOp)
79-
# target_include_directories(MetaCling SYSTEM PUBLIC ${source_dir}/include/)
8079

8180
##### libCling #############################################################
8281

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

+8
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

@@ -1612,6 +1614,12 @@ TCling::TCling(const char *name, const char *title, const char* const argv[], vo
16121614
// Initialize the dyld for AutoloadLibraryGenerator.
16131615
DLM.initializeDyld(ShouldPermanentlyIgnore);
16141616
}
1617+
1618+
// Tell CppInterOp that the cling::Interpreter instance is managed externally by ROOT
1619+
// We pass the handle so it sets the ownership flags and sets the interpreter as soon as TCling is initialized
1620+
if (!Cpp::GetInterpreter()) {
1621+
Cpp::UseExternalInterpreter((Cpp::TInterp_t*)fInterpreter.get());
1622+
}
16151623
}
16161624

16171625

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

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ C++ interpreter and the Clang C++ compiler, not CINT.
6767

6868
#include "clang/Sema/SemaInternal.h"
6969

70+
#include "clang/Interpreter/CppInterOp.h"
71+
7072
#include <map>
7173
#include <string>
7274
#include <sstream>

0 commit comments

Comments
 (0)