@@ -23,19 +23,20 @@ TEST(ThreadSafeModuleTest, ContextWhollyOwnedByOneModule) {
23
23
// Test that ownership of a context can be transferred to a single
24
24
// ThreadSafeModule.
25
25
ThreadSafeContext TSCtx (llvm::make_unique<LLVMContext>());
26
- ThreadSafeModule TSM ( llvm::make_unique<Module>(" M" , *TSCtx.getContext ()),
27
- std::move (TSCtx));
26
+ auto M = llvm::make_unique<Module>(" M" , *TSCtx.getContext ());
27
+ ThreadSafeModule TSM ( std::move (M), std::move (TSCtx));
28
28
}
29
29
30
30
TEST (ThreadSafeModuleTest, ContextOwnershipSharedByTwoModules) {
31
31
// Test that ownership of a context can be shared between more than one
32
32
// ThreadSafeModule.
33
33
ThreadSafeContext TSCtx (llvm::make_unique<LLVMContext>());
34
34
35
- ThreadSafeModule TSM1 (llvm::make_unique<Module>(" M1" , *TSCtx.getContext ()),
36
- TSCtx);
37
- ThreadSafeModule TSM2 (llvm::make_unique<Module>(" M2" , *TSCtx.getContext ()),
38
- std::move (TSCtx));
35
+ auto M1 =llvm::make_unique<Module>(" M1" , *TSCtx.getContext ());
36
+ ThreadSafeModule TSM1 (std::move (M1), TSCtx);
37
+
38
+ auto M2 =llvm::make_unique<Module>(" M2" , *TSCtx.getContext ());
39
+ ThreadSafeModule TSM2 (std::move (M2), std::move (TSCtx));
39
40
}
40
41
41
42
TEST (ThreadSafeModuleTest, ContextOwnershipSharedWithClient) {
@@ -45,30 +46,30 @@ TEST(ThreadSafeModuleTest, ContextOwnershipSharedWithClient) {
45
46
46
47
{
47
48
// Create and destroy a module.
48
- ThreadSafeModule TSM1 ( llvm::make_unique<Module>(" M1" , *TSCtx.getContext ()),
49
- TSCtx);
49
+ auto M1 = llvm::make_unique<Module>(" M1" , *TSCtx.getContext ());
50
+ ThreadSafeModule TSM1 ( std::move (M1), TSCtx);
50
51
}
51
52
52
53
// Verify that the context is still available for re-use.
53
- ThreadSafeModule TSM2 ( llvm::make_unique<Module>(" M2" , *TSCtx.getContext ()),
54
- std::move (TSCtx));
54
+ auto M2 = llvm::make_unique<Module>(" M2" , *TSCtx.getContext ());
55
+ ThreadSafeModule TSM2 ( std::move (M2), std::move (TSCtx));
55
56
}
56
57
57
58
TEST (ThreadSafeModuleTest, ThreadSafeModuleMoveAssignment) {
58
59
// Move assignment needs to move the module before the context (opposite
59
60
// to the field order) to ensure that overwriting with an empty
60
61
// ThreadSafeModule does not destroy the context early.
61
62
ThreadSafeContext TSCtx (llvm::make_unique<LLVMContext>());
62
- ThreadSafeModule TSM ( llvm::make_unique<Module>(" M" , *TSCtx.getContext ()),
63
- std::move (TSCtx));
63
+ auto M = llvm::make_unique<Module>(" M" , *TSCtx.getContext ());
64
+ ThreadSafeModule TSM ( std::move (M), std::move (TSCtx));
64
65
TSM = ThreadSafeModule ();
65
66
}
66
67
67
68
TEST (ThreadSafeModuleTest, BasicContextLockAPI) {
68
69
// Test that basic lock API calls work.
69
70
ThreadSafeContext TSCtx (llvm::make_unique<LLVMContext>());
70
- ThreadSafeModule TSM ( llvm::make_unique<Module>(" M" , *TSCtx.getContext ()),
71
- TSCtx);
71
+ auto M = llvm::make_unique<Module>(" M" , *TSCtx.getContext ());
72
+ ThreadSafeModule TSM ( std::move (M), TSCtx);
72
73
73
74
{ auto L = TSCtx.getLock (); }
74
75
0 commit comments