@@ -24,9 +24,8 @@ class LinkModuleTest : public testing::Test {
24
24
virtual void SetUp () {
25
25
LLVMContext &Ctx = getGlobalContext ();
26
26
M.reset (new Module (" MyModule" , Ctx));
27
- FunctionType *FTy = FunctionType::get (Type::getInt8PtrTy (Ctx),
28
- Type::getInt32Ty (Ctx),
29
- false /* =isVarArg*/ );
27
+ FunctionType *FTy = FunctionType::get (
28
+ Type::getInt8PtrTy (Ctx), Type::getInt32Ty (Ctx), false /* =isVarArg*/ );
30
29
F = Function::Create (FTy, Function::ExternalLinkage, " ba_func" , M.get ());
31
30
F->setCallingConv (CallingConv::C);
32
31
@@ -38,29 +37,25 @@ class LinkModuleTest : public testing::Test {
38
37
ArrayType *AT = ArrayType::get (Type::getInt8PtrTy (Ctx), 3 );
39
38
40
39
GV = new GlobalVariable (*M.get (), AT, false /* =isConstant*/ ,
41
- GlobalValue::InternalLinkage,
42
- 0 , " switch.bas" );
43
-
40
+ GlobalValue::InternalLinkage, 0 , " switch.bas" );
44
41
45
42
// Global Initializer
46
- std::vector<Constant*> Init;
43
+ std::vector<Constant *> Init;
47
44
Constant *SwitchCase1BA = BlockAddress::get (SwitchCase1BB);
48
45
Init.push_back (SwitchCase1BA);
49
46
50
47
Constant *SwitchCase2BA = BlockAddress::get (SwitchCase2BB);
51
48
Init.push_back (SwitchCase2BA);
52
49
53
50
ConstantInt *One = ConstantInt::get (Type::getInt32Ty (Ctx), 1 );
54
- Constant *OnePtr = ConstantExpr::getCast (Instruction::IntToPtr,
55
- One, Type::getInt8PtrTy (Ctx));
51
+ Constant *OnePtr = ConstantExpr::getCast (Instruction::IntToPtr, One,
52
+ Type::getInt8PtrTy (Ctx));
56
53
Init.push_back (OnePtr);
57
54
58
55
GV->setInitializer (ConstantArray::get (AT, Init));
59
56
}
60
57
61
- virtual void TearDown () {
62
- M.reset ();
63
- }
58
+ virtual void TearDown () { M.reset (); }
64
59
65
60
OwningPtr<Module> M;
66
61
Function *F;
@@ -75,7 +70,7 @@ TEST_F(LinkModuleTest, BlockAddress) {
75
70
LLVMContext &Ctx = getGlobalContext ();
76
71
IRBuilder<> Builder (EntryBB);
77
72
78
- std::vector<Value*> GEPIndices;
73
+ std::vector<Value *> GEPIndices;
79
74
GEPIndices.push_back (ConstantInt::get (Type::getInt32Ty (Ctx), 0 ));
80
75
GEPIndices.push_back (F->arg_begin ());
81
76
@@ -117,7 +112,7 @@ TEST_F(LinkModuleTest, BlockAddress) {
117
112
LinkedModule->getFunction (" ba_func" ));
118
113
EXPECT_EQ (cast<BlockAddress>(Elem)->getBasicBlock ()->getParent (),
119
114
LinkedModule->getFunction (" ba_func" ));
120
-
115
+
121
116
Elem = Init->getOperand (1 );
122
117
ASSERT_TRUE (isa<BlockAddress>(Elem));
123
118
EXPECT_EQ (cast<BlockAddress>(Elem)->getFunction (),
0 commit comments