[obj2yaml] - Stop triggering UB when dumping corrupted strings.
[llvm-complete.git] / unittests / tools / llvm-exegesis / X86 / TestBase.h
blobc60cd76e53c34d9113de12bb7be8f3cb4d6a855b
1 //===-- TestBase.cpp --------------------------------------------*- 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 //===----------------------------------------------------------------------===//
8 // Test fixture common to all X86 tests.
9 //===----------------------------------------------------------------------===//
11 #ifndef LLVM_UNITTESTS_TOOLS_LLVMEXEGESIS_X86_TESTBASE_H
12 #define LLVM_UNITTESTS_TOOLS_LLVMEXEGESIS_X86_TESTBASE_H
14 #include "LlvmState.h"
15 #include "llvm/Support/TargetRegistry.h"
16 #include "llvm/Support/TargetSelect.h"
17 #include "gmock/gmock.h"
18 #include "gtest/gtest.h"
20 namespace llvm {
21 namespace exegesis {
23 void InitializeX86ExegesisTarget();
25 class X86TestBase : public ::testing::Test {
26 protected:
27 X86TestBase() : State("x86_64-unknown-linux", "haswell") {}
29 static void SetUpTestCase() {
30 LLVMInitializeX86TargetInfo();
31 LLVMInitializeX86TargetMC();
32 LLVMInitializeX86Target();
33 LLVMInitializeX86AsmPrinter();
34 LLVMInitializeX86AsmParser();
35 InitializeX86ExegesisTarget();
38 const LLVMState State;
41 } // namespace exegesis
42 } // namespace llvm
44 #endif