1 //===- unittests/Interpreter/InterpreterTestBase.h ------------------ C++ -===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_UNITTESTS_INTERPRETER_INTERPRETERTESTBASE_H
10 #define LLVM_CLANG_UNITTESTS_INTERPRETER_INTERPRETERTESTBASE_H
12 #include "llvm/ExecutionEngine/Orc/LLJIT.h"
13 #include "llvm/Support/Error.h"
14 #include "llvm/Support/ManagedStatic.h"
15 #include "llvm/Support/TargetSelect.h"
17 #include "gtest/gtest.h"
19 #if defined(_AIX) || defined(__MVS__)
20 #define CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
25 class InterpreterTestBase
: public ::testing::Test
{
27 static bool HostSupportsJIT() {
28 #ifdef CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
31 if (auto JIT
= llvm::orc::LLJITBuilder().create()) {
34 llvm::consumeError(JIT
.takeError());
40 void SetUp() override
{
41 if (!HostSupportsJIT())
45 void TearDown() override
{}
47 static void SetUpTestSuite() {
48 llvm::InitializeNativeTarget();
49 llvm::InitializeNativeTargetAsmPrinter();
52 static void TearDownTestSuite() { llvm::llvm_shutdown(); }
57 #undef CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
59 #endif // LLVM_CLANG_UNITTESTS_INTERPRETER_INTERPRETERTESTBASE_H