aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2023-09-22 14:39:45 -0700
committerLang Hames <lhames@gmail.com>2023-09-22 16:18:20 -0700
commite1a5bb59b91d60c0d87feb78f0e0614589a4c927 (patch)
tree4e1682914782777dee11d535b54cddf4173a1afa /clang
parentab7896231e176e52801702b7221bcac2f4ffbd59 (diff)
downloadllvm-e1a5bb59b91d60c0d87feb78f0e0614589a4c927.zip
llvm-e1a5bb59b91d60c0d87feb78f0e0614589a4c927.tar.gz
llvm-e1a5bb59b91d60c0d87feb78f0e0614589a4c927.tar.bz2
[ORC][LLJIT] Move enable-debugger-support utility out of LLJITBuilder.
This change means that debugger support only needs to be linked in if it's used. The code size of debugger support is expected to increase as we improve it (e.g. pulling in DWARF parsing), so making it an optional extra is useful for controlling final binary sizes.
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Interpreter/IncrementalExecutor.cpp10
-rw-r--r--clang/tools/clang-repl/ClangRepl.cpp4
-rw-r--r--clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp4
-rw-r--r--clang/unittests/Interpreter/InterpreterTest.cpp4
4 files changed, 11 insertions, 11 deletions
diff --git a/clang/lib/Interpreter/IncrementalExecutor.cpp b/clang/lib/Interpreter/IncrementalExecutor.cpp
index 2c4dfc9..2692d06 100644
--- a/clang/lib/Interpreter/IncrementalExecutor.cpp
+++ b/clang/lib/Interpreter/IncrementalExecutor.cpp
@@ -17,6 +17,7 @@
#include "clang/Interpreter/PartialTranslationUnit.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
+#include "llvm/ExecutionEngine/Orc/DebuggerSupport.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
@@ -46,8 +47,13 @@ IncrementalExecutor::IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC,
JTMB.addFeatures(TI.getTargetOpts().Features);
LLJITBuilder Builder;
Builder.setJITTargetMachineBuilder(JTMB);
- // Enable debugging of JIT'd code (only works on JITLink for ELF and MachO).
- Builder.setEnableDebuggerSupport(true);
+ Builder.setPrePlatformSetup(
+ [](LLJIT &J) {
+ // Try to enable debugging of JIT'd code (only works with JITLink for
+ // ELF and MachO).
+ consumeError(enableDebuggerSupport(J));
+ return llvm::Error::success();
+ });
if (auto JitOrErr = Builder.create())
Jit = std::move(*JitOrErr);
diff --git a/clang/tools/clang-repl/ClangRepl.cpp b/clang/tools/clang-repl/ClangRepl.cpp
index 51741fd..a29a2eb 100644
--- a/clang/tools/clang-repl/ClangRepl.cpp
+++ b/clang/tools/clang-repl/ClangRepl.cpp
@@ -152,9 +152,7 @@ int main(int argc, const char **argv) {
llvm::InitializeAllAsmPrinters();
if (OptHostSupportsJit) {
- auto J = llvm::orc::LLJITBuilder()
- .setEnableDebuggerSupport(true)
- .create();
+ auto J = llvm::orc::LLJITBuilder().create();
if (J)
llvm::outs() << "true\n";
else {
diff --git a/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp b/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
index 8700f50..70e10b1 100644
--- a/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
+++ b/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
@@ -52,9 +52,7 @@ TEST(InterpreterTest, CatchException) {
llvm::InitializeNativeTargetAsmPrinter();
{
- auto J = llvm::orc::LLJITBuilder()
- .setEnableDebuggerSupport(true)
- .create();
+ auto J = llvm::orc::LLJITBuilder().create();
if (!J) {
// The platform does not support JITs.
// Using llvm::consumeError will require typeinfo for ErrorInfoBase, we
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp
index 62e5bac..5f2911e 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -191,9 +191,7 @@ static std::string MangleName(NamedDecl *ND) {
}
static bool HostSupportsJit() {
- auto J = llvm::orc::LLJITBuilder()
- .setEnableDebuggerSupport(true)
- .create();
+ auto J = llvm::orc::LLJITBuilder().create();
if (J)
return true;
LLVMConsumeError(llvm::wrap(J.takeError()));