diff options
author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2021-07-29 07:30:06 +0000 |
---|---|---|
committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2021-09-01 05:23:21 +0000 |
commit | 319ce98011742141dad8dd95a2f9de9c0449be5c (patch) | |
tree | 22a9c210ac00b1e3475b22e23741566e868cfd45 /clang/lib/Interpreter/Interpreter.cpp | |
parent | 98f47131228cc73b5308e3cc6fd70375808594e3 (diff) | |
download | llvm-319ce98011742141dad8dd95a2f9de9c0449be5c.zip llvm-319ce98011742141dad8dd95a2f9de9c0449be5c.tar.gz llvm-319ce98011742141dad8dd95a2f9de9c0449be5c.tar.bz2 |
[clang-repl] Re-implement clang-interpreter as a test case.
The current infrastructure in lib/Interpreter has a tool, clang-repl, very
similar to clang-interpreter which also allows incremental compilation.
This patch moves clang-interpreter as a test case and drops it as conditionally
built example as we already have clang-repl in place.
Differential revision: https://reviews.llvm.org/D107049
Diffstat (limited to 'clang/lib/Interpreter/Interpreter.cpp')
-rw-r--r-- | clang/lib/Interpreter/Interpreter.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index 937504f..84589b5 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -35,8 +35,7 @@ using namespace clang; // FIXME: Figure out how to unify with namespace init_convenience from -// tools/clang-import-test/clang-import-test.cpp and -// examples/clang-interpreter/main.cpp +// tools/clang-import-test/clang-import-test.cpp namespace { /// Retrieves the clang CC1 specific flags out of the compilation's jobs. /// \returns NULL on error. @@ -223,3 +222,13 @@ llvm::Error Interpreter::Execute(PartialTranslationUnit &T) { return llvm::Error::success(); } + +llvm::Expected<llvm::JITTargetAddress> +Interpreter::getSymbolAddress(llvm::StringRef UnmangledName) const { + if (!IncrExecutor) + return llvm::make_error<llvm::StringError>("Operation failed. " + "No execution engine", + std::error_code()); + + return IncrExecutor->getSymbolAddress(UnmangledName); +} |