File tree 1 file changed +22
-0
lines changed
clang/unittests/Interpreter 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 17
17
#include " clang/Sema/Lookup.h"
18
18
#include " clang/Sema/Sema.h"
19
19
20
+ #include " llvm/ExecutionEngine/Orc/LLJIT.h"
20
21
#include " llvm/Support/Error.h"
22
+ #include " llvm/Support/TargetSelect.h"
21
23
#include " llvm/Testing/Support/Error.h"
22
24
23
25
#include " gmock/gmock.h"
27
29
using namespace clang ;
28
30
namespace {
29
31
32
+ static bool HostSupportsJit () {
33
+ auto J = llvm::orc::LLJITBuilder ().create ();
34
+ if (J)
35
+ return true ;
36
+ LLVMConsumeError (llvm::wrap (J.takeError ()));
37
+ return false ;
38
+ }
39
+
40
+ struct LLVMInitRAII {
41
+ LLVMInitRAII () {
42
+ llvm::InitializeNativeTarget ();
43
+ llvm::InitializeNativeTargetAsmPrinter ();
44
+ }
45
+ ~LLVMInitRAII () { llvm::llvm_shutdown (); }
46
+ } LLVMInit;
47
+
30
48
class TestCreateResetExecutor : public Interpreter {
31
49
public:
32
50
TestCreateResetExecutor (std::unique_ptr<CompilerInstance> CI,
@@ -39,6 +57,10 @@ class TestCreateResetExecutor : public Interpreter {
39
57
};
40
58
41
59
TEST (InterpreterExtensionsTest, ExecutorCreateReset) {
60
+ // Make sure we can create the executer on the platform.
61
+ if (!HostSupportsJit ())
62
+ GTEST_SKIP ();
63
+
42
64
clang::IncrementalCompilerBuilder CB;
43
65
llvm::Error ErrOut = llvm::Error::success ();
44
66
TestCreateResetExecutor Interp (cantFail (CB.CreateCpp ()), ErrOut);
You can’t perform that action at this time.
0 commit comments