aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2023-09-27 13:05:04 -0700
committerLang Hames <lhames@gmail.com>2023-09-27 13:24:02 -0700
commit61b0f12d6b9cdcb6bb3dd679e3a3c36fa94daeae (patch)
treec762663b306843f0c39196e3c05435404845b72e /clang
parent1fd2251bce4aa5bfe4a021c4b5f156e40443373d (diff)
downloadllvm-61b0f12d6b9cdcb6bb3dd679e3a3c36fa94daeae.zip
llvm-61b0f12d6b9cdcb6bb3dd679e3a3c36fa94daeae.tar.gz
llvm-61b0f12d6b9cdcb6bb3dd679e3a3c36fa94daeae.tar.bz2
Re-apply "[ORC][LLJIT] Move enable-debugger-support utility out of..."
This re-applies e1a5bb59b91, which was reverted in e5f169f91a8 due to LSan failures on some bots (see https://github.com/llvm/llvm-project/issues/67586). The LSan failures were not caused by this patch (just exposed by it), so LSan was disabled for the failing test in 47625fea5e3. This should be safe to re-land now.
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 4709a94..2f1c4ef 100644
--- a/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
+++ b/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
@@ -60,9 +60,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()));