1 //===- llvm/unittest/Transforms/IPO/AttributorTestBase.h -----------------===//
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 /// This file defines an AttributorTestBase class, which provides helpers to
10 /// parse a LLVM IR string and create Attributor
11 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_UNITTESTS_TRANSFORMS_ATTRIBUTOR_TESTBASE_H
13 #define LLVM_UNITTESTS_TRANSFORMS_ATTRIBUTOR_TESTBASE_H
15 #include "llvm/Analysis/CGSCCPassManager.h"
16 #include "llvm/Analysis/CallGraphSCCPass.h"
17 #include "llvm/AsmParser/Parser.h"
18 #include "llvm/IR/Module.h"
19 #include "llvm/IR/PassManager.h"
20 #include "llvm/Support/Allocator.h"
21 #include "llvm/Support/SourceMgr.h"
22 #include "llvm/Testing/Support/Error.h"
23 #include "llvm/Transforms/IPO/Attributor.h"
24 #include "llvm/Transforms/Utils/CallGraphUpdater.h"
25 #include "gtest/gtest.h"
30 /// Helper class to create a module from assembly string and an Attributor
31 class AttributorTestBase
: public testing::Test
{
33 std::unique_ptr
<LLVMContext
> Ctx
;
34 std::unique_ptr
<Module
> M
;
36 AttributorTestBase() : Ctx(new LLVMContext
) {}
38 Module
&parseModule(const char *ModuleString
) {
40 M
= parseAssemblyString(ModuleString
, Err
, *Ctx
);