Skip to content

Commit aaf0c92

Browse files
vgvassilevtstellar
authored andcommitted
[clang-repl] Add an accessor to our underlying execution engine
This patch will allow better incremental adoption of these changes in downstream cling and other users which want to experiment by customizing the execution engine. (cherry picked from commit 788e0f7)
1 parent d150523 commit aaf0c92

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

clang/include/clang/Interpreter/Interpreter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
namespace llvm {
2828
namespace orc {
29+
class LLJIT;
2930
class ThreadSafeContext;
3031
}
3132
} // namespace llvm
@@ -56,6 +57,7 @@ class Interpreter {
5657
static llvm::Expected<std::unique_ptr<Interpreter>>
5758
create(std::unique_ptr<CompilerInstance> CI);
5859
const CompilerInstance *getCompilerInstance() const;
60+
const llvm::orc::LLJIT *getExecutionEngine() const;
5961
llvm::Expected<PartialTranslationUnit &> Parse(llvm::StringRef Code);
6062
llvm::Error Execute(PartialTranslationUnit &T);
6163
llvm::Error ParseAndExecute(llvm::StringRef Code) {

clang/lib/Interpreter/IncrementalExecutor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class IncrementalExecutor {
4545
llvm::Error runCtors() const;
4646
llvm::Expected<llvm::JITTargetAddress>
4747
getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const;
48+
llvm::orc::LLJIT *getExecutionEngine() const { return Jit.get(); }
4849
};
4950

5051
} // end namespace clang

clang/lib/Interpreter/Interpreter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ const CompilerInstance *Interpreter::getCompilerInstance() const {
196196
return IncrParser->getCI();
197197
}
198198

199+
const llvm::orc::LLJIT *Interpreter::getExecutionEngine() const {
200+
if (IncrExecutor)
201+
return IncrExecutor->getExecutionEngine();
202+
return nullptr;
203+
}
204+
199205
llvm::Expected<PartialTranslationUnit &>
200206
Interpreter::Parse(llvm::StringRef Code) {
201207
return IncrParser->Parse(Code);

0 commit comments

Comments
 (0)