@@ -296,35 +296,36 @@ TEST(TweakTest, ExtractVariable) {
296
296
checkAvailable (ID, R"cpp(
297
297
int xyz() {
298
298
// return statement
299
- return ^1 ;
299
+ return [[1]] ;
300
300
}
301
301
void f() {
302
- int a = 5 + [[4 ^* ^ xyz^() ]];
302
+ int a = [[ 5 +]] [[4 * [[[[ xyz]]()]] ]];
303
303
// multivariable initialization
304
304
if(1)
305
- int x = ^1 , y = ^a + 1, a = ^1 , z = a + 1;
305
+ int x = [[1]] , y = [[a]] + 1, a = [[1]] , z = a + 1;
306
306
// if without else
307
- if(^1) {}
307
+ if([[1]])
308
+ a = [[1]];
308
309
// if with else
309
- if(a < ^3 )
310
- if(a == ^4 )
311
- a = ^5 ;
310
+ if(a < [[3]] )
311
+ if(a == [[4]] )
312
+ a = [[5]] ;
312
313
else
313
- a = ^6 ;
314
- else if (a < ^4 )
315
- a = ^4 ;
314
+ a = [[5]] ;
315
+ else if (a < [[4]] )
316
+ a = [[4]] ;
316
317
else
317
- a = ^5 ;
318
+ a = [[5]] ;
318
319
// for loop
319
- for(a = ^1 ; a > ^3^+^4 ; a++)
320
- a = ^2 ;
320
+ for(a = [[1]] ; a > [[[[3]] + [[4]]]] ; a++)
321
+ a = [[2]] ;
321
322
// while
322
- while(a < ^1 )
323
- ^a ++;
323
+ while(a < [[1]] )
324
+ [[a]] ++;
324
325
// do while
325
326
do
326
- a = ^1 ;
327
- while(a < ^3 );
327
+ a = [[1]] ;
328
+ while(a < [[3]] );
328
329
}
329
330
)cpp" );
330
331
// Should not crash.
@@ -336,29 +337,31 @@ TEST(TweakTest, ExtractVariable) {
336
337
};
337
338
)cpp" );
338
339
checkNotAvailable (ID, R"cpp(
339
- int xyz(int a = ^1 ) {
340
+ int xyz(int a = [[1]] ) {
340
341
return 1;
341
342
class T {
342
- T(int a = ^1 ) {};
343
- int xyz = ^1 ;
343
+ T(int a = [[1]] ) {};
344
+ int xyz = [[1]] ;
344
345
};
345
346
}
346
347
// function default argument
347
- void f(int b = ^1) {
348
+ void f(int b = [[1]]) {
349
+ // empty selection
350
+ int a = ^1 ^+ ^2;
348
351
// void expressions
349
352
auto i = new int, j = new int;
350
- de^lete i^, del^ete j ;
353
+ [[[[delete i]], delete j]] ;
351
354
// if
352
355
if(1)
353
- int x = 1, y = a + 1, a = 1, z = ^ a + 1;
356
+ int x = 1, y = a + 1, a = 1, z = [[ a + 1]] ;
354
357
if(int a = 1)
355
- if(^a == 4)
356
- a = ^a ^+ 1;
358
+ if([[a]] == 4)
359
+ a = [[[[a]] +]] 1;
357
360
// for loop
358
- for(int a = 1, b = 2, c = 3; ^a > ^b ^+ ^c; ^a ++)
359
- a = ^a ^ + 1;
361
+ for(int a = 1, b = 2, c = 3; [[a]] > [[b + c]]; [[a]] ++)
362
+ a = [[a + 1]] ;
360
363
// lambda
361
- auto lamb = [&^a , &^b] (int r = ^1 ) {return 1;}
364
+ auto lamb = [&[[a]] , &[[b]]] (int r = [[1]] ) {return 1;}
362
365
}
363
366
)cpp" );
364
367
// vector of pairs of input and output strings
@@ -398,7 +401,7 @@ TEST(TweakTest, ExtractVariable) {
398
401
{R"cpp( #define LOOP(x) {int a = x + 1;}
399
402
void f(int a) {
400
403
if(1)
401
- LOOP(5 + ^3 )
404
+ LOOP(5 + [[3]] )
402
405
})cpp" ,
403
406
R"cpp( #define LOOP(x) {int a = x + 1;}
404
407
void f(int a) {
@@ -407,22 +410,22 @@ TEST(TweakTest, ExtractVariable) {
407
410
})cpp" },
408
411
// label and attribute testing
409
412
{R"cpp( void f(int a) {
410
- label: [ [gsl::suppress("type")] ] for (;;) a = ^1 ;
413
+ label: [ [gsl::suppress("type")] ] for (;;) a = [[1]] ;
411
414
})cpp" ,
412
415
R"cpp( void f(int a) {
413
416
auto dummy = 1; label: [ [gsl::suppress("type")] ] for (;;) a = dummy;
414
417
})cpp" },
415
418
// FIXME: Doesn't work because bug in selection tree
416
419
/* {R"cpp(#define PLUS(x) x++
417
420
void f(int a) {
418
- PLUS(^a );
421
+ PLUS([[a]] );
419
422
})cpp",
420
423
R"cpp(#define PLUS(x) x++
421
424
void f(int a) {
422
425
auto dummy = a; PLUS(dummy);
423
426
})cpp"},*/
424
- // FIXME: Doesn't work correctly for \[\[clang::uninitialized\]\] int b
425
- // = 1 ; since the attr is inside the DeclStmt and the bounds of
427
+ // FIXME: Doesn't work correctly for \[\[clang::uninitialized\]\] int
428
+ // b = [[1]] ; since the attr is inside the DeclStmt and the bounds of
426
429
// DeclStmt don't cover the attribute
427
430
};
428
431
for (const auto &IO : InputOutputs) {
0 commit comments