[LV] Add test showing debug output for loops with uncountable BTCs.
[llvm-project.git] / clang / unittests / Interpreter / InterpreterTestFixture.h
blob113599ff988946cd0a32763a037d9a4183472d42
1 //===- unittests/Interpreter/InterpreterTestBase.h ------------------ C++ -===//
2 //
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
6 //
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
21 #endif
23 namespace clang {
25 class InterpreterTestBase : public ::testing::Test {
26 protected:
27 static bool HostSupportsJIT() {
28 #ifdef CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
29 return false;
30 #else
31 if (auto JIT = llvm::orc::LLJITBuilder().create()) {
32 return true;
33 } else {
34 llvm::consumeError(JIT.takeError());
35 return false;
37 #endif
40 void SetUp() override {
41 if (!HostSupportsJIT())
42 GTEST_SKIP();
45 void TearDown() override {}
47 static void SetUpTestSuite() {
48 llvm::InitializeNativeTarget();
49 llvm::InitializeNativeTargetAsmPrinter();
52 static void TearDownTestSuite() { llvm::llvm_shutdown(); }
55 } // namespace clang
57 #undef CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
59 #endif // LLVM_CLANG_UNITTESTS_INTERPRETER_INTERPRETERTESTBASE_H