diff options
author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2022-03-11 11:12:11 +0300 |
---|---|---|
committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2022-03-11 12:24:47 +0300 |
commit | 788e0f7f3e96a9d61c2412e452c4589e2693b79a (patch) | |
tree | a4aa8f25daf36ad9946d4631008e49c39878869d /clang | |
parent | e732f69ea1fdca2c4c0c56600e03f0d8d82e1c29 (diff) |
[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.
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Interpreter/Interpreter.h | 2 | ||||
-rw-r--r-- | clang/lib/Interpreter/IncrementalExecutor.h | 1 | ||||
-rw-r--r-- | clang/lib/Interpreter/Interpreter.cpp | 6 |
3 files changed, 9 insertions, 0 deletions
diff --git a/clang/include/clang/Interpreter/Interpreter.h b/clang/include/clang/Interpreter/Interpreter.h index 721a649deb43..f2fdb90f5ba4 100644 --- a/clang/include/clang/Interpreter/Interpreter.h +++ b/clang/include/clang/Interpreter/Interpreter.h @@ -26,6 +26,7 @@ namespace llvm { namespace orc { +class LLJIT; class ThreadSafeContext; } } // namespace llvm @@ -56,6 +57,7 @@ public: static llvm::Expected<std::unique_ptr<Interpreter>> create(std::unique_ptr<CompilerInstance> CI); const CompilerInstance *getCompilerInstance() const; + const llvm::orc::LLJIT *getExecutionEngine() const; llvm::Expected<PartialTranslationUnit &> Parse(llvm::StringRef Code); llvm::Error Execute(PartialTranslationUnit &T); llvm::Error ParseAndExecute(llvm::StringRef Code) { diff --git a/clang/lib/Interpreter/IncrementalExecutor.h b/clang/lib/Interpreter/IncrementalExecutor.h index 24447994d5f1..51b4d83d10b1 100644 --- a/clang/lib/Interpreter/IncrementalExecutor.h +++ b/clang/lib/Interpreter/IncrementalExecutor.h @@ -45,6 +45,7 @@ public: llvm::Error runCtors() const; llvm::Expected<llvm::JITTargetAddress> getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const; + llvm::orc::LLJIT *getExecutionEngine() const { return Jit.get(); } }; } // end namespace clang diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index b2e7727be39a..470c9c289a74 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -196,6 +196,12 @@ const CompilerInstance *Interpreter::getCompilerInstance() const { return IncrParser->getCI(); } +const llvm::orc::LLJIT *Interpreter::getExecutionEngine() const { + if (IncrExecutor) + return IncrExecutor->getExecutionEngine(); + return nullptr; +} + llvm::Expected<PartialTranslationUnit &> Interpreter::Parse(llvm::StringRef Code) { return IncrParser->Parse(Code); |