@@ -51,6 +51,13 @@ def test_swift_move_function(self):
51
51
self .do_check_copyable_var_test ()
52
52
self .do_check_addressonly_value_test ()
53
53
self .do_check_addressonly_var_test ()
54
+
55
+ # argument simple tests
56
+ self .do_check_copyable_value_arg_test ()
57
+ self .do_check_copyable_var_arg_test ()
58
+ self .do_check_addressonly_value_arg_test ()
59
+ self .do_check_addressonly_var_arg_test ()
60
+
54
61
# ccf is conditional control flow
55
62
self .do_check_copyable_value_ccf_true ()
56
63
self .do_check_copyable_value_ccf_false ()
@@ -90,6 +97,16 @@ def do_setup_breakpoints(self):
90
97
self .add_breakpoints ('copyableVarTest' , 4 ))
91
98
self .breakpoints .extend (
92
99
self .add_breakpoints ('addressOnlyVarTest' , 4 ))
100
+
101
+ self .breakpoints .extend (
102
+ self .add_breakpoints ('copyableValueArgTest' , 3 ))
103
+ self .breakpoints .extend (
104
+ self .add_breakpoints ('addressOnlyValueArgTest' , 3 ))
105
+ self .breakpoints .extend (
106
+ self .add_breakpoints ('copyableVarArgTest' , 4 ))
107
+ self .breakpoints .extend (
108
+ self .add_breakpoints ('addressOnlyVarArgTest' , 4 ))
109
+
93
110
self .breakpoints .extend (
94
111
self .add_breakpoints ('copyableValueCCFTrueTest' ,
95
112
5 ))
@@ -186,6 +203,92 @@ def do_check_addressonly_var_test(self):
186
203
# Run so we hit the next breakpoint as part of the next test.
187
204
self .runCmd ('continue' )
188
205
206
+ def do_check_copyable_value_arg_test (self ):
207
+ # k is defined by the argument so it is valid.
208
+ varK = self .get_var ('k' )
209
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
210
+
211
+ # Go to break point 2. k should be valid.
212
+ self .runCmd ('continue' )
213
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
214
+
215
+ # Go to breakpoint 3. k should no longer be valid.
216
+ self .runCmd ('continue' )
217
+ #self.assertIsNone(varK.value, "K is live but was moved?!")
218
+
219
+ # Run so we hit the next breakpoint to jump to the next test's
220
+ # breakpoint.
221
+ self .runCmd ('continue' )
222
+
223
+ def do_check_copyable_var_arg_test (self ):
224
+ # k is already defined and is an argument.
225
+ varK = self .get_var ('k' )
226
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
227
+
228
+ # Go to break point 2. k should be valid.
229
+ self .runCmd ('continue' )
230
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
231
+
232
+ # Go to breakpoint 3. We invalidated k
233
+ self .runCmd ('continue' )
234
+ self .assertIsNone (varK .value , "K is live but was moved?!" )
235
+
236
+ # Go to the last breakpoint and make sure that k is reinitialized
237
+ # properly.
238
+ self .runCmd ('continue' )
239
+ # TODO: There is an error here. We are losing the debug info here
240
+ # for some reason.
241
+ #self.assertGreater(varK.unsigned, 0, "varK not initialized")
242
+ self .assertIsNone (varK .value , "K is live but was moved?!" )
243
+
244
+ # Run so we hit the next breakpoint to go to the next test.
245
+ self .runCmd ('continue' )
246
+
247
+ def do_check_addressonly_value_arg_test (self ):
248
+ # k is defined since it is an argument.
249
+ varK = self .get_var ('k' )
250
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
251
+
252
+ # Go to break point 2. k should be valid and m should not be. Since M is
253
+ # a dbg.declare it is hard to test robustly that it is not initialized
254
+ # so we don't do so. We have an additional llvm.dbg.addr test where we
255
+ # move the other variable and show the correct behavior with
256
+ # llvm.dbg.declare.
257
+ self .runCmd ('continue' )
258
+ self .assertGreater (varK .unsigned , 0 , "var not initialized?!" )
259
+
260
+ # Go to breakpoint 3.
261
+ self .runCmd ('continue' )
262
+ self .assertEqual (varK .unsigned , 0 ,
263
+ "dbg thinks varK is live despite move?!" )
264
+
265
+ # Run so we hit the next breakpoint as part of the next test.
266
+ self .runCmd ('continue' )
267
+
268
+ def do_check_addressonly_var_arg_test (self ):
269
+ varK = self .get_var ('k' )
270
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
271
+
272
+ # Go to break point 2. k should be valid.
273
+ self .runCmd ('continue' )
274
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
275
+
276
+ # Go to breakpoint 3. K was invalidated.
277
+ self .runCmd ('continue' )
278
+ self .assertIsNone (varK .value , "K is live but was moved?!" )
279
+
280
+ # Go to the last breakpoint and make sure that k is reinitialized
281
+ # properly.
282
+ self .runCmd ('continue' )
283
+ # There is some sort of bug here. We should have the value here. For now
284
+ # leave the next line commented out and validate we are not seeing the
285
+ # value so we can detect change in behavior.
286
+ #self.assertGreater(varK.unsigned, 0, "varK not initialized")
287
+ self .assertIsNone (varK .value , "K is live but was moved?!" )
288
+
289
+ # Run so we hit the next breakpoint as part of the next test.
290
+ self .runCmd ('continue' )
291
+
189
292
def do_check_copyable_value_ccf_true (self ):
190
293
varK = self .get_var ('k' )
191
294
0 commit comments