@@ -1459,68 +1459,83 @@ TEST_F(DILocationTest, Merge) {
1459
1459
#endif
1460
1460
// Identical, including source atom numbers.
1461
1461
{
1462
- auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1463
- auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1462
+ auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1463
+ /* AtomRank*/ 1 );
1464
+ auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1465
+ /* AtomRank*/ 1 );
1464
1466
auto *M = DILocation::getMergedLocation (A, B);
1465
- EXPECT_ATOM (M, 1u , 1u );
1467
+ EXPECT_ATOM (M, /* AtomGroup */ 1u , 1u );
1466
1468
// DILocations are uniqued, so we can check equality by ptr.
1467
1469
EXPECT_EQ (M, DILocation::getMergedLocation (A, B));
1468
1470
}
1469
1471
1470
1472
// Identical but different atom ranks (same atom) - choose the lowest nonzero
1471
1473
// rank.
1472
1474
{
1473
- auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1474
- auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 2 );
1475
+ auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1476
+ /* AtomRank*/ 1 );
1477
+ auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1478
+ /* AtomRank*/ 2 );
1475
1479
auto *M = DILocation::getMergedLocation (A, B);
1476
- EXPECT_ATOM (M, 1u , 1u );
1480
+ EXPECT_ATOM (M, /* AtomGroup */ 1u , /* AtomRank */ 1u );
1477
1481
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1478
1482
1479
- A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 0 );
1480
- B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 2 );
1483
+ A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1484
+ /* AtomRank*/ 0 );
1485
+ B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1486
+ /* AtomRank*/ 2 );
1481
1487
M = DILocation::getMergedLocation (A, B);
1482
- EXPECT_ATOM (M, 1u , 2u );
1488
+ EXPECT_ATOM (M, /* AtomGroup */ 1u , /* AtomRank */ 2u );
1483
1489
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1484
1490
}
1485
1491
1486
1492
// Identical but different atom ranks (different atom) - choose the lowest
1487
1493
// nonzero rank.
1488
1494
{
1489
- auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1490
- auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 2 , 2 );
1495
+ auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1496
+ /* AtomRank*/ 1 );
1497
+ auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 2 ,
1498
+ /* AtomRank*/ 2 );
1491
1499
auto *M = DILocation::getMergedLocation (A, B);
1492
1500
EXPECT_ATOM (M, 1u , 1u );
1493
1501
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1494
1502
1495
- A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 0 );
1496
- B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 2 , 2 );
1503
+ A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1504
+ /* AtomRank*/ 0 );
1505
+ B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 2 ,
1506
+ /* AtomRank*/ 2 );
1497
1507
M = DILocation::getMergedLocation (A, B);
1498
- EXPECT_ATOM (M, 2u , 2u );
1508
+ EXPECT_ATOM (M, /* AtomGroup */ 2u , /* AtomRank */ 2u );
1499
1509
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1500
1510
}
1501
1511
1502
1512
// Identical but equal atom rank (different atom) - choose the lowest non-zero
1503
1513
// group (arbitrary choice for deterministic behaviour).
1504
1514
{
1505
- auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 1 , 1 );
1506
- auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 2 , 1 );
1515
+ auto *A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 1 ,
1516
+ /* AtomRank*/ 1 );
1517
+ auto *B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 2 ,
1518
+ /* AtomRank*/ 1 );
1507
1519
auto *M = DILocation::getMergedLocation (A, B);
1508
1520
EXPECT_ATOM (M, 1u , 1u );
1509
1521
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1510
1522
1511
- A = DILocation::get (Context, 2 , 7 , N, nullptr , false , 0 , 1 );
1512
- B = DILocation::get (Context, 2 , 7 , N, nullptr , false , 2 , 1 );
1523
+ A = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 0 ,
1524
+ /* AtomRank*/ 1 );
1525
+ B = DILocation::get (Context, 2 , 7 , N, nullptr , false , /* AtomGroup*/ 2 ,
1526
+ /* AtomRank*/ 1 );
1513
1527
M = DILocation::getMergedLocation (A, B);
1514
- EXPECT_ATOM (M, 2u , 1u );
1528
+ EXPECT_ATOM (M, /* AtomGroup */ 2u , /* AtomRank */ 1u );
1515
1529
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1516
1530
}
1517
1531
1518
1532
// Completely different except same atom numbers. Zero out the atoms.
1519
1533
{
1520
1534
auto *I = DILocation::get (Context, 2 , 7 , N);
1521
- auto *A = DILocation::get (Context, 1 , 6 , S, I, false , 1 , 1 );
1522
- auto *B =
1523
- DILocation::get (Context, 2 , 7 , getSubprogram (), nullptr , false , 1 , 1 );
1535
+ auto *A = DILocation::get (Context, 1 , 6 , S, I, false , /* AtomGroup*/ 1 ,
1536
+ /* AtomRank*/ 1 );
1537
+ auto *B = DILocation::get (Context, 2 , 7 , getSubprogram (), nullptr , false ,
1538
+ /* AtomGroup*/ 1 , /* AtomRank*/ 1 );
1524
1539
auto *M = DILocation::getMergedLocation (A, B);
1525
1540
EXPECT_EQ (0u , M->getLine ());
1526
1541
EXPECT_EQ (0u , M->getColumn ());
@@ -1534,16 +1549,20 @@ TEST_F(DILocationTest, Merge) {
1534
1549
{
1535
1550
auto *I = DILocation::get (Context, 1 , 7 , N);
1536
1551
auto *F = getSubprogram ();
1537
- auto *A = DILocation::get (Context, 1 , 1 , F, I, false , 1 , 2 );
1538
- auto *B = DILocation::get (Context, 1 , 1 , F, I, false , 2 , 1 );
1552
+ auto *A = DILocation::get (Context, 1 , 1 , F, I, false , /* AtomGroup*/ 1 ,
1553
+ /* AtomRank*/ 2 );
1554
+ auto *B = DILocation::get (Context, 1 , 1 , F, I, false , /* AtomGroup*/ 2 ,
1555
+ /* AtomRank*/ 1 );
1539
1556
auto *M = DILocation::getMergedLocation (A, B);
1540
- EXPECT_ATOM (M, 2u , 1u );
1557
+ EXPECT_ATOM (M, 2u , /* AtomRank */ 1u );
1541
1558
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1542
1559
1543
- A = DILocation::get (Context, 1 , 1 , F, I, false , 1 , 2 );
1544
- B = DILocation::get (Context, 1 , 1 , F, I, false , 2 , 0 );
1560
+ A = DILocation::get (Context, 1 , 1 , F, I, false , /* AtomGroup*/ 1 ,
1561
+ /* AtomRank*/ 2 );
1562
+ B = DILocation::get (Context, 1 , 1 , F, I, false , /* AtomGroup*/ 2 ,
1563
+ /* AtomRank*/ 0 );
1545
1564
M = DILocation::getMergedLocation (A, B);
1546
- EXPECT_ATOM (M, 1u , 2u );
1565
+ EXPECT_ATOM (M, /* AtomGroup */ 1u , /* AtomRank */ 2u );
1547
1566
EXPECT_EQ (M, DILocation::getMergedLocation (B, A));
1548
1567
}
1549
1568
@@ -1559,24 +1578,25 @@ TEST_F(DILocationTest, Merge) {
1559
1578
auto *FY = getSubprogram ();
1560
1579
auto *FZ = getSubprogram ();
1561
1580
auto *Z4 = DILocation::get (Context, 1 , 4 , FZ);
1562
- auto *Y3IntoZ4 = DILocation::get (Context, 1 , 3 , FY, Z4, false , 1 , 1 );
1581
+ auto *Y3IntoZ4 = DILocation::get (Context, 1 , 3 , FY, Z4, false ,
1582
+ /* AtomGroup*/ 1 , /* AtomRank*/ 1 );
1563
1583
auto *Y2IntoZ4 = DILocation::get (Context, 1 , 2 , FY, Z4);
1564
1584
auto *X1IntoY2 = DILocation::get (Context, 1 , 1 , FX, Y2IntoZ4);
1565
1585
auto *M = DILocation::getMergedLocation (X1IntoY2, Y3IntoZ4);
1566
1586
EXPECT_EQ (M->getScope (), FY);
1567
1587
EXPECT_EQ (M->getInlinedAt ()->getScope (), FZ);
1568
- EXPECT_ATOM (M, 2u , 1u );
1588
+ EXPECT_ATOM (M, /* AtomGroup */ 2u , /* AtomRank */ 1u );
1569
1589
1570
1590
// This swapped merge will produce a new atom group too.
1571
1591
M = DILocation::getMergedLocation (Y3IntoZ4, X1IntoY2);
1572
1592
1573
1593
// Same again, even if the atom numbers match.
1574
- auto *X1IntoY2SameAtom =
1575
- DILocation::get (Context, 1 , 1 , FX, Y2IntoZ4, false , 1 , 1 );
1594
+ auto *X1IntoY2SameAtom = DILocation::get (Context, 1 , 1 , FX, Y2IntoZ4, false ,
1595
+ /* AtomGroup */ 1 , /* AtomRank */ 1 );
1576
1596
M = DILocation::getMergedLocation (X1IntoY2SameAtom, Y3IntoZ4);
1577
- EXPECT_ATOM (M, 4u , 1u );
1597
+ EXPECT_ATOM (M, /* AtomGroup */ 4u , /* AtomRank */ 1u );
1578
1598
M = DILocation::getMergedLocation (Y3IntoZ4, X1IntoY2SameAtom);
1579
- EXPECT_ATOM (M, 5u , 1u );
1599
+ EXPECT_ATOM (M, /* AtomGroup */ 5u , /* AtomRank */ 1u );
1580
1600
}
1581
1601
#undef EXPECT_ATOM
1582
1602
}
0 commit comments