aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorVassil Vassilev <v.g.vassilev@gmail.com>2021-09-01 08:02:46 +0000
committerVassil Vassilev <v.g.vassilev@gmail.com>2021-09-01 10:21:38 +0000
commitf0514a4d26100239088f08d618f2ba100f59958e (patch)
tree8b429c3a85c13c0757946d21e9bc2db2166dd393 /clang/lib/Interpreter/Interpreter.cpp
parent893ac53afc1ae3d433fee2835a1c5db00369d0c4 (diff)
downloadllvm-f0514a4d26100239088f08d618f2ba100f59958e.zip
llvm-f0514a4d26100239088f08d618f2ba100f59958e.tar.gz
llvm-f0514a4d26100239088f08d618f2ba100f59958e.tar.bz2
Reland "[clang-repl] Re-implement clang-interpreter as a test case."
Original commit message:" 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 " This patch also ignores ppc due to missing weak symbol for __gxx_personality_v0 which may be a feature request for the jit infrastructure. Also, adds a missing build system dependency to the orc jit.
Diffstat (limited to 'clang/lib/Interpreter/Interpreter.cpp')
-rw-r--r--clang/lib/Interpreter/Interpreter.cpp13
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);
+}