aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorVassil Vassilev <v.g.vassilev@gmail.com>2021-10-05 14:31:30 +0000
committerVassil Vassilev <v.g.vassilev@gmail.com>2021-10-08 06:04:39 +0000
commit1dba6b37bdc70210f75a480eff3715ebe1f1d8be (patch)
tree6b85bdc97bba3b17e2f70d96294eeaae692b69b3 /clang/lib/Interpreter/Interpreter.cpp
parent0091e913ebfac1ec4a5185cc16e3eb7549149f91 (diff)
downloadllvm-1dba6b37bdc70210f75a480eff3715ebe1f1d8be.zip
llvm-1dba6b37bdc70210f75a480eff3715ebe1f1d8be.tar.gz
llvm-1dba6b37bdc70210f75a480eff3715ebe1f1d8be.tar.bz2
Reland "[clang-repl] Re-implement clang-interpreter as a test case."
Original commit message: " Original commit message: " 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. " Additionally, this patch defines a custom exception type and thus avoids the requirement to include header <exception>, making it easier to deploy across systems without standard location of the c++ headers. " This patch also works around PR49692 and finds a way to use llvm::consumeError in rtti mode. Differential revision: https://reviews.llvm.org/D107049
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 28c6c4f..4237a4a 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -36,8 +36,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.
@@ -219,3 +218,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);
+}