Skip to content

Commit 9392e07

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 a1a6491 commit 9392e07

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

core/metacling/src/TCling.cxx

Lines changed: 6 additions & 0 deletions
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

@@ -1609,6 +1611,10 @@ TCling::TCling(const char *name, const char *title, const char* const argv[], vo
16091611
// Initialize the dyld for AutoloadLibraryGenerator.
16101612
DLM.initializeDyld(ShouldPermanentlyIgnore);
16111613
}
1614+
1615+
// Tell CppInterOp that the cling::Interpreter instance is managed externally by ROOT
1616+
// We pass the handle so it sets the ownership flags and sets the interpreter as soon as TCling is initialized
1617+
Cpp::UseExternalInterpreter((Cpp::TInterp_t*)fInterpreter.get());
16121618
}
16131619

16141620

core/metacling/src/TClingCallFunc.cxx

Lines changed: 2 additions & 0 deletions
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)